]> git.eshelyaron.com Git - emacs.git/commitdiff
Add some very rudimentary field-beginning/end tests
authorLars Ingebrigtsen <larsi@gnus.org>
Sun, 19 Dec 2021 16:12:18 +0000 (17:12 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Sun, 19 Dec 2021 16:12:18 +0000 (17:12 +0100)
test/src/editfns-tests.el

index e83dd7c857ba2c26872c12b54201538c71c4a508..6b2eb32396ea1e9cbcb1fe33ff03e4976405e32c 100644 (file)
       (translate-region-internal (point-min) (point-max) tt)
       (should (string-equal (buffer-string) "*")))))
 
+(ert-deftest find-fields ()
+  (with-temp-buffer
+    (insert "foo" (propertize "bar" 'field 'bar) "zot")
+    (goto-char (point-min))
+    (should (= (field-beginning) (point-min)))
+    (should (= (field-end) 4))
+    (goto-char 5)
+    (should (= (field-beginning) 4))
+    (should (= (field-end) 7))
+    (goto-char 8)
+    (should (= (field-beginning) 7))
+    (should (= (field-end) (point-max)))))
+
 ;;; editfns-tests.el ends here