diff --git a/test/difftastic-next-file.erts b/test/difftastic-next-file.erts new file mode 100644 index 0000000..b73ef66 --- /dev/null +++ b/test/difftastic-next-file.erts @@ -0,0 +1,348 @@ +Code: difftastic-next-file + +Name: difftastic-next-file:file-wo-chunks-to-file-wo-chunks-1 +Point-Char: | +=-= +|difftastic.el --- Emacs Lisp +1 ;;; difftastic.el --- Wrapper for difftastic -*- lexical-binding: t; -*- + +test/difftastic.t.el --- Emacs Lisp +1 ;;; difftastic.t.el --- Tests for difftastic -*- lexical-binding: t; -*- +=-= +difftastic.el --- Emacs Lisp +1 ;;; difftastic.el --- Wrapper for difftastic -*- lexical-binding: t; -*- + +|test/difftastic.t.el --- Emacs Lisp +1 ;;; difftastic.t.el --- Tests for difftastic -*- lexical-binding: t; -*- +=-=-= + +Name: difftastic-next-file:file-wo-chunks-to-file-wo-chunks-2 +Point-Char: | +=-= +difftastic.el| --- Emacs Lisp +1 ;;; difftastic.el --- Wrapper for difftastic -*- lexical-binding: t; -*- + +test/difftastic.t.el --- Emacs Lisp +1 ;;; difftastic.t.el --- Tests for difftastic -*- lexical-binding: t; -*- +=-= +difftastic.el --- Emacs Lisp +1 ;;; difftastic.el --- Wrapper for difftastic -*- lexical-binding: t; -*- + +|test/difftastic.t.el --- Emacs Lisp +1 ;;; difftastic.t.el --- Tests for difftastic -*- lexical-binding: t; -*- +=-=-= + +Name: difftastic-next-file:file-wo-chunks-to-file-wo-chunks-3 +Point-Char: | +=-= +difftastic.el --- Emacs Lisp +|1 ;;; difftastic.el --- Wrapper for difftastic -*- lexical-binding: t; -*- + +test/difftastic.t.el --- Emacs Lisp +1 ;;; difftastic.t.el --- Tests for difftastic -*- lexical-binding: t; -*- +=-= +difftastic.el --- Emacs Lisp +1 ;;; difftastic.el --- Wrapper for difftastic -*- lexical-binding: t; -*- + +|test/difftastic.t.el --- Emacs Lisp +1 ;;; difftastic.t.el --- Tests for difftastic -*- lexical-binding: t; -*- +=-=-= + +Name: difftastic-next-file:last-chunk-to-file-wo-chunks-1 +Point-Char: | +=-= +difftastic.el --- 1/2 --- Emacs Lisp +1 ;;; difftastic.el --- Wrapper for difftastic -*- lexical-binding: t; -*- + +|difftastic.el --- 2/2 --- Emacs Lisp +9 ;; Version: 0.0.0 + +test/difftastic.t.el --- Emacs Lisp +1 ;;; difftastic.t.el --- Tests for difftastic -*- lexical-binding: t; -*- +=-= +difftastic.el --- 1/2 --- Emacs Lisp +1 ;;; difftastic.el --- Wrapper for difftastic -*- lexical-binding: t; -*- + +difftastic.el --- 2/2 --- Emacs Lisp +9 ;; Version: 0.0.0 + +|test/difftastic.t.el --- Emacs Lisp +1 ;;; difftastic.t.el --- Tests for difftastic -*- lexical-binding: t; -*- +=-=-= + +Name: difftastic-next-file:last-chunk-to-file-wo-chunks-2 +Point-Char: | +=-= +difftastic.el --- 1/2 --- Emacs Lisp +1 ;;; difftastic.el --- Wrapper for difftastic -*- lexical-binding: t; -*- + +difftastic.el --- 2/2 --- Emacs Li|sp +9 ;; Version: 0.0.0 + +test/difftastic.t.el --- Emacs Lisp +1 ;;; difftastic.t.el --- Tests for difftastic -*- lexical-binding: t; -*- +=-= +difftastic.el --- 1/2 --- Emacs Lisp +1 ;;; difftastic.el --- Wrapper for difftastic -*- lexical-binding: t; -*- + +difftastic.el --- 2/2 --- Emacs Lisp +9 ;; Version: 0.0.0 + +|test/difftastic.t.el --- Emacs Lisp +1 ;;; difftastic.t.el --- Tests for difftastic -*- lexical-binding: t; -*- +=-=-= + +Name: difftastic-next-file:last-chunk-to-file-wo-chunks-3 +Point-Char: | +=-= +difftastic.el --- 1/2 --- Emacs Lisp +1 ;;; difftastic.el --- Wrapper for difftastic -*- lexical-binding: t; -*- + +difftastic.el --- 2/2 --- Emacs Lisp +9 ;; Version: 0.0.0| + +test/difftastic.t.el --- Emacs Lisp +1 ;;; difftastic.t.el --- Tests for difftastic -*- lexical-binding: t; -*- +=-= +difftastic.el --- 1/2 --- Emacs Lisp +1 ;;; difftastic.el --- Wrapper for difftastic -*- lexical-binding: t; -*- + +difftastic.el --- 2/2 --- Emacs Lisp +9 ;; Version: 0.0.0 + +|test/difftastic.t.el --- Emacs Lisp +1 ;;; difftastic.t.el --- Tests for difftastic -*- lexical-binding: t; -*- +=-=-= + +Name: difftastic-next-file:first-chunk-to-file-wo-chunks-1 +Point-Char: | +=-= +|difftastic.el --- 1/2 --- Emacs Lisp +1 ;;; difftastic.el --- Wrapper for difftastic -*- lexical-binding: t; -*- + +difftastic.el --- 2/2 --- Emacs Lisp +9 ;; Version: 0.0.0 + +test/difftastic.t.el --- Emacs Lisp +1 ;;; difftastic.t.el --- Tests for difftastic -*- lexical-binding: t; -*- +=-= +difftastic.el --- 1/2 --- Emacs Lisp +1 ;;; difftastic.el --- Wrapper for difftastic -*- lexical-binding: t; -*- + +difftastic.el --- 2/2 --- Emacs Lisp +9 ;; Version: 0.0.0 + +|test/difftastic.t.el --- Emacs Lisp +1 ;;; difftastic.t.el --- Tests for difftastic -*- lexical-binding: t; -*- +=-=-= + +Name: difftastic-next-file:first-chunk-to-file-wo-chunks-2 +Point-Char: | +=-= +difftastic.e|l --- 1/2 --- Emacs Lisp +1 ;;; difftastic.el --- Wrapper for difftastic -*- lexical-binding: t; -*- + +difftastic.el --- 2/2 --- Emacs Lisp +9 ;; Version: 0.0.0 + +test/difftastic.t.el --- Emacs Lisp +1 ;;; difftastic.t.el --- Tests for difftastic -*- lexical-binding: t; -*- +=-= +difftastic.el --- 1/2 --- Emacs Lisp +1 ;;; difftastic.el --- Wrapper for difftastic -*- lexical-binding: t; -*- + +difftastic.el --- 2/2 --- Emacs Lisp +9 ;; Version: 0.0.0 + +|test/difftastic.t.el --- Emacs Lisp +1 ;;; difftastic.t.el --- Tests for difftastic -*- lexical-binding: t; -*- +=-=-= + +Name: difftastic-next-file:first-chunk-to-file-wo-chunks-3 +Point-Char: | +=-= +difftastic.el --- 1/2 --- Emacs Lisp +1 ;;; difftastic.el| --- Wrapper for difftastic -*- lexical-binding: t; -*- + +difftastic.el --- 2/2 --- Emacs Lisp +9 ;; Version: 0.0.0 + +test/difftastic.t.el --- Emacs Lisp +1 ;;; difftastic.t.el --- Tests for difftastic -*- lexical-binding: t; -*- +=-= +difftastic.el --- 1/2 --- Emacs Lisp +1 ;;; difftastic.el --- Wrapper for difftastic -*- lexical-binding: t; -*- + +difftastic.el --- 2/2 --- Emacs Lisp +9 ;; Version: 0.0.0 + +|test/difftastic.t.el --- Emacs Lisp +1 ;;; difftastic.t.el --- Tests for difftastic -*- lexical-binding: t; -*- +=-=-= + +Name: difftastic-next-file:last-chunk-to-file-with-chunks-1 +Point-Char: | +=-= +difftastic.el --- 1/2 --- Emacs Lisp +1 ;;; difftastic.el --- Wrapper for difftastic -*- lexical-binding: t; -*- + +|difftastic.el --- 2/2 --- Emacs Lisp +9 ;; Version: 0.0.0 + +test/difftastic.t.el --- 1/2 --- Emacs Lisp +1 ;;; difftastic.t.el --- Tests for difftastic -*- lexical-binding: t; -*- + +test/difftastic.t.el --- 2/2 --- Emacs Lisp +5 (require 'difftastic) +=-= +difftastic.el --- 1/2 --- Emacs Lisp +1 ;;; difftastic.el --- Wrapper for difftastic -*- lexical-binding: t; -*- + +difftastic.el --- 2/2 --- Emacs Lisp +9 ;; Version: 0.0.0 + +|test/difftastic.t.el --- 1/2 --- Emacs Lisp +1 ;;; difftastic.t.el --- Tests for difftastic -*- lexical-binding: t; -*- + +test/difftastic.t.el --- 2/2 --- Emacs Lisp +5 (require 'difftastic) +=-=-= + +Name: difftastic-next-file:last-chunk-to-file-with-chunks-2 +Point-Char: | +=-= +difftastic.el --- 1/2 --- Emacs Lisp +1 ;;; difftastic.el --- Wrapper for difftastic -*- lexical-binding: t; -*- + +difftastic.el --- 2/2 --- Emacs Lisp| +9 ;; Version: 0.0.0 + +test/difftastic.t.el --- 1/2 --- Emacs Lisp +1 ;;; difftastic.t.el --- Tests for difftastic -*- lexical-binding: t; -*- + +test/difftastic.t.el --- 2/2 --- Emacs Lisp +5 (require 'difftastic) +=-= +difftastic.el --- 1/2 --- Emacs Lisp +1 ;;; difftastic.el --- Wrapper for difftastic -*- lexical-binding: t; -*- + +difftastic.el --- 2/2 --- Emacs Lisp +9 ;; Version: 0.0.0 + +|test/difftastic.t.el --- 1/2 --- Emacs Lisp +1 ;;; difftastic.t.el --- Tests for difftastic -*- lexical-binding: t; -*- + +test/difftastic.t.el --- 2/2 --- Emacs Lisp +5 (require 'difftastic) +=-=-= + +Name: difftastic-next-file:last-chunk-to-file-with-chunks-3 +Point-Char: | +=-= +difftastic.el --- 1/2 --- Emacs Lisp +1 ;;; difftastic.el --- Wrapper for difftastic -*- lexical-binding: t; -*- + +difftastic.el --- 2/2 --- Emacs Lisp +9 ;; Version: 0.0.0 +| +test/difftastic.t.el --- 1/2 --- Emacs Lisp +1 ;;; difftastic.t.el --- Tests for difftastic -*- lexical-binding: t; -*- + +test/difftastic.t.el --- 2/2 --- Emacs Lisp +5 (require 'difftastic) +=-= +difftastic.el --- 1/2 --- Emacs Lisp +1 ;;; difftastic.el --- Wrapper for difftastic -*- lexical-binding: t; -*- + +difftastic.el --- 2/2 --- Emacs Lisp +9 ;; Version: 0.0.0 + +|test/difftastic.t.el --- 1/2 --- Emacs Lisp +1 ;;; difftastic.t.el --- Tests for difftastic -*- lexical-binding: t; -*- + +test/difftastic.t.el --- 2/2 --- Emacs Lisp +5 (require 'difftastic) +=-=-= +Name: difftastic-next-file:first-chunk-to-file-with-chunks-1 +Point-Char: | +=-= +|difftastic.el --- 1/2 --- Emacs Lisp +1 ;;; difftastic.el --- Wrapper for difftastic -*- lexical-binding: t; -*- + +difftastic.el --- 2/2 --- Emacs Lisp +9 ;; Version: 0.0.0 + +test/difftastic.t.el --- 1/2 --- Emacs Lisp +1 ;;; difftastic.t.el --- Tests for difftastic -*- lexical-binding: t; -*- + +test/difftastic.t.el --- 2/2 --- Emacs Lisp +5 (require 'difftastic) +=-= +difftastic.el --- 1/2 --- Emacs Lisp +1 ;;; difftastic.el --- Wrapper for difftastic -*- lexical-binding: t; -*- + +difftastic.el --- 2/2 --- Emacs Lisp +9 ;; Version: 0.0.0 + +|test/difftastic.t.el --- 1/2 --- Emacs Lisp +1 ;;; difftastic.t.el --- Tests for difftastic -*- lexical-binding: t; -*- + +test/difftastic.t.el --- 2/2 --- Emacs Lisp +5 (require 'difftastic) +=-=-= + +Name: difftastic-next-file:last-chunk-to-file-with-chunks-2 +Point-Char: | +=-= +difftastic.el --- 1/2 --- Ema|cs Lisp +1 ;;; difftastic.el --- Wrapper for difftastic -*- lexical-binding: t; -*- + +difftastic.el --- 2/2 --- Emacs Lisp +9 ;; Version: 0.0.0 + +test/difftastic.t.el --- 1/2 --- Emacs Lisp +1 ;;; difftastic.t.el --- Tests for difftastic -*- lexical-binding: t; -*- + +test/difftastic.t.el --- 2/2 --- Emacs Lisp +5 (require 'difftastic) +=-= +difftastic.el --- 1/2 --- Emacs Lisp +1 ;;; difftastic.el --- Wrapper for difftastic -*- lexical-binding: t; -*- + +difftastic.el --- 2/2 --- Emacs Lisp +9 ;; Version: 0.0.0 + +|test/difftastic.t.el --- 1/2 --- Emacs Lisp +1 ;;; difftastic.t.el --- Tests for difftastic -*- lexical-binding: t; -*- + +test/difftastic.t.el --- 2/2 --- Emacs Lisp +5 (require 'difftastic) +=-=-= + +Name: difftastic-next-file:last-chunk-to-file-with-chunks-3 +Point-Char: | +=-= +difftastic.el --- 1/2 --- Emacs Lisp +1 ;;; difftastic.el --- Wrapper for |difftastic -*- lexical-binding: t; -*- + +difftastic.el --- 2/2 --- Emacs Lisp +9 ;; Version: 0.0.0 + +test/difftastic.t.el --- 1/2 --- Emacs Lisp +1 ;;; difftastic.t.el --- Tests for difftastic -*- lexical-binding: t; -*- + +test/difftastic.t.el --- 2/2 --- Emacs Lisp +5 (require 'difftastic) +=-= +difftastic.el --- 1/2 --- Emacs Lisp +1 ;;; difftastic.el --- Wrapper for difftastic -*- lexical-binding: t; -*- + +difftastic.el --- 2/2 --- Emacs Lisp +9 ;; Version: 0.0.0 + +|test/difftastic.t.el --- 1/2 --- Emacs Lisp +1 ;;; difftastic.t.el --- Tests for difftastic -*- lexical-binding: t; -*- + +test/difftastic.t.el --- 2/2 --- Emacs Lisp +5 (require 'difftastic) +=-=-= diff --git a/test/difftastic.t.el b/test/difftastic.t.el index 49279d2..1ea975f 100644 --- a/test/difftastic.t.el +++ b/test/difftastic.t.el @@ -519,6 +519,36 @@ :type 'user-error) (should (equal (point-min) (point)))))) +(ert-deftest difftastic-next-file:erts-scenarios () + (when (fboundp 'ert-test-erts-file) ;; since Emacs-29 + (mocklet ((difftastic--get-languages => '("Text" "Emacs Lisp" "C++" "Java"))) + (let ((file "difftastic-next-file.erts") + scenarios) + (should (or (file-exists-p file) + (file-exists-p (format "test/%s" file)))) + (setq scenarios (if (file-exists-p file) + file + (format "test/%s" file))) + (ert-test-erts-file scenarios))))) + +(ert-deftest difftastic-next-file:empty-buffer-error-signaled () + (mocklet ((difftastic--get-languages => '("Text" "Emacs Lisp" "C++" "Java"))) + (with-temp-buffer + (difftastic-mode) + (should-error (difftastic-next-file) + :type 'user-error)))) + +(ert-deftest difftastic-next-file:last-chunk-error-signaled () + (mocklet ((difftastic--get-languages => '("Text" "Emacs Lisp" "C++" "Java"))) + (with-temp-buffer + (insert "difftastic.el --- Emacs Lisp +1 ;;; difftastic.el --- Wrapper for difftastic -*- lexical-binding: t; -*-") + (difftastic-mode) + (goto-char (point-min)) + (should-error (difftastic-next-file) + :type 'user-error) + (should (equal (point-min) (point)))))) + (ert-deftest difftastic-previous-chunk:erts-scenarios () (when (fboundp 'ert-test-erts-file) ;; since Emacs-29 (mocklet ((difftastic--get-languages => '("Text" "Emacs Lisp" "C++" "Java")))