]> git.eshelyaron.com Git - emacs.git/commitdiff
; New log-edit tests
authorPo Lu <luangruo@yahoo.com>
Sun, 28 Jan 2024 08:55:33 +0000 (16:55 +0800)
committerEshel Yaron <me@eshelyaron.com>
Wed, 31 Jan 2024 20:11:01 +0000 (21:11 +0100)
* test/lisp/vc/log-edit-tests.el
(log-edit-fill-entry-confinement): Test confinement in various
contrived scenarious.

(cherry picked from commit d664814a8d40da63f1906218b73aec62f2cd4d18)

test/lisp/vc/log-edit-tests.el

index 1a2af716f349a44c5367afa0e96064b25d382c3d..5b555809f4c60a4d85d2c991a567992711a55f11 100644 (file)
@@ -134,4 +134,55 @@ lines."))))
 * a-very-long-directory-name/another-long-directory-name/and-a-long-file-name.ext
 \(a-really-long-function-name):"))))
 
+(ert-deftest log-edit-fill-entry-confinement ()
+  (let (string string1 string2 string3 string4)
+    (setq string
+          ;; This entry is precisely 65 columns in length;
+          ;; log-edit-fill-column should leave it unmodified.
+          "* file2.txt (fun4, fun5, fun6, fun7, fun8, fun9, fun10, fun1134):"
+          string1
+          ;; This entry is 66 columns in length, and must be filled.
+          "* file2.txt (fun4, fun5, fun6, fun7, fun8, fun9, fun10, fun11345):"
+          string2
+          ;; The first line of this entry totals 65 columns in length,
+          ;; and should be preserved intact.
+          "* file2.txt (fun4, fun5, fun6, fun7, fun8, fun9, fun10, fun11345)
+(fun11356):"
+          string3
+          ;; The first defun in this entry is a file name that brings
+          ;; the total to 40 columns in length and should be preserved
+          ;; intact.
+          "* file2.txt (abcdefghijklmnopqrstuvwxyz)
+(ABC):"
+          string4
+          ;; The first defun brings that total to 41, and should be
+          ;; placed on the next line.
+          "* file2.txt (abcdefghijklmnopqrstuvwxyz):")
+    (with-temp-buffer
+      (insert string)
+      (let ((fill-column 64)) (log-edit-fill-entry))
+      (should (equal (buffer-string) string))
+      (erase-buffer)
+      (insert string1)
+      (let ((fill-column 64)) (log-edit-fill-entry))
+      (should (equal (buffer-string)
+                     "* file2.txt (fun4, fun5, fun6, fun7, fun8, fun9, fun10)
+(fun11345):"))
+      (erase-buffer)
+      (insert string2)
+      (let ((fill-column 64)) (log-edit-fill-entry))
+      (should (equal (buffer-string) string2))
+      (erase-buffer)
+      (insert string3)
+      (let ((fill-column 39)) (log-edit-fill-entry))
+      (should (equal (buffer-string) string3))
+      (erase-buffer)
+      (insert string4)
+      (let ((fill-column 39)) (log-edit-fill-entry))
+      (should (equal (buffer-string)
+                     ;; There is whitespace after "file2.txt" which
+                     ;; should not be erased!
+                     "* file2.txt 
+(abcdefghijklmnopqrstuvwxyz):")))))
+
 ;;; log-edit-tests.el ends here