emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/compat dab2ec091d 01/16: Restore tests


From: ELPA Syncer
Subject: [elpa] externals/compat dab2ec091d 01/16: Restore tests
Date: Wed, 4 Jan 2023 07:57:26 -0500 (EST)

branch: externals/compat
commit dab2ec091d51bb0220453f1a3d28664f4d3ccd92
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>

    Restore tests
---
 compat-tests.el | 119 +++++++++++++++++++-------------------------------------
 1 file changed, 41 insertions(+), 78 deletions(-)

diff --git a/compat-tests.el b/compat-tests.el
index aaa36bb825..4bf187dad1 100644
--- a/compat-tests.el
+++ b/compat-tests.el
@@ -32,6 +32,7 @@
 (require 'ert)
 (require 'compat)
 (require 'subr-x)
+(require 'text-property-search nil t)
 (setq ert-quiet t)
 
 (ert-deftest compat-call ()
@@ -249,6 +250,46 @@
     (json-insert '((:key . ["abc" 2]) (yek . t)))
     (should (equal (buffer-string) "{\":key\":[\"abc\",2],\"yek\":true}"))))
 
+(ert-deftest compat-text-property-search-forward ()
+  (with-temp-buffer
+    (insert "one "
+            (propertize "two " 'prop 'val)
+            "three "
+            (propertize "four " 'prop 'wert)
+            "five ")
+    (goto-char (point-min))
+    (let ((match (text-property-search-forward 'prop)))
+      (should (eq (prop-match-beginning match) 5))
+      (should (eq (prop-match-end match) 9))
+      (should (eq (prop-match-value match) 'val)))
+    (let ((match (text-property-search-forward 'prop)))
+      (should (eq (prop-match-beginning match) 15))
+      (should (eq (prop-match-end match) 20))
+      (should (eq (prop-match-value match) 'wert)))
+    (should (null (text-property-search-forward 'prop)))
+    (goto-char (point-min))
+    (should (null (text-property-search-forward 'non-existant)))))
+
+(ert-deftest compat-text-property-search-backward ()
+  (with-temp-buffer
+    (insert "one "
+            (propertize "two " 'prop 'val)
+            "three "
+            (propertize "four " 'prop 'wert)
+            "five ")
+    (goto-char (point-max))
+    (let ((match (text-property-search-backward 'prop)))
+      (should (eq (prop-match-beginning match) 15))
+      (should (eq (prop-match-end match) 20))
+      (should (eq (prop-match-value match) 'wert)))
+    (let ((match (text-property-search-backward 'prop)))
+      (should (eq (prop-match-beginning match) 5))
+      (should (eq (prop-match-end match) 9))
+      (should (eq (prop-match-value match) 'val)))
+    (should (null (text-property-search-backward 'prop)))
+    (goto-char (point-max))
+    (should (null (text-property-search-backward 'non-existant)))))
+
 ;; (defun compat--expect (name compat)
 ;;   "Implementation for the `expect' macro for NAME.
 ;; COMPAT is the name of the compatibility function the behaviour is
@@ -1771,83 +1812,5 @@
 ;;         #'compat--make-prop-match-with-vector
 ;;       #'compat--make-prop-match-with-record)))
 
-;; (ert-deftest compat-text-property-search-forward ()
-;;   (when (fboundp 'text-property-search-forward)
-;;     (with-temp-buffer
-;;       (insert "one "
-;;               (propertize "two " 'prop 'val)
-;;               "three "
-;;               (propertize "four " 'prop 'wert)
-;;               "five ")
-;;       (goto-char (point-min))
-;;       (let ((match (text-property-search-forward 'prop)))
-;;         (should (eq (prop-match-beginning match) 5))
-;;         (should (eq (prop-match-end match) 9))
-;;         (should (eq (prop-match-value match) 'val)))
-;;       (let ((match (text-property-search-forward 'prop)))
-;;         (should (eq (prop-match-beginning match) 15))
-;;         (should (eq (prop-match-end match) 20))
-;;         (should (eq (prop-match-value match) 'wert)))
-;;       (should (null (text-property-search-forward 'prop)))
-;;       (goto-char (point-min))
-;;       (should (null (text-property-search-forward 'non-existant)))))
-;;   (with-temp-buffer
-;;     (insert "one "
-;;             (propertize "two " 'prop 'val)
-;;             "three "
-;;             (propertize "four " 'prop 'wert)
-;;             "five ")
-;;     (goto-char (point-min))
-;;     (let ((match (compat--t-text-property-search-forward 'prop)))
-;;       (should (eq (compat--t-prop-match-beginning match) 5))
-;;       (should (eq (compat--t-prop-match-end match) 9))
-;;       (should (eq (compat--t-prop-match-value match) 'val)))
-;;     (let ((match (compat--t-text-property-search-forward 'prop)))
-;;       (should (eq (compat--t-prop-match-beginning match) 15))
-;;       (should (eq (compat--t-prop-match-end match) 20))
-;;       (should (eq (compat--t-prop-match-value match) 'wert)))
-;;     (should (null (compat--t-text-property-search-forward 'prop)))
-;;     (goto-char (point-min))
-;;     (should (null (compat--t-text-property-search-forward 'non-existant)))))
-
-;; (ert-deftest compat-text-property-search-backward ()
-;;   (when (fboundp 'text-property-search-backward)
-;;     (with-temp-buffer
-;;       (insert "one "
-;;               (propertize "two " 'prop 'val)
-;;               "three "
-;;               (propertize "four " 'prop 'wert)
-;;               "five ")
-;;       (goto-char (point-max))
-;;       (let ((match (text-property-search-backward 'prop)))
-;;         (should (eq (prop-match-beginning match) 15))
-;;         (should (eq (prop-match-end match) 20))
-;;         (should (eq (prop-match-value match) 'wert)))
-;;       (let ((match (text-property-search-backward 'prop)))
-;;         (should (eq (prop-match-beginning match) 5))
-;;         (should (eq (prop-match-end match) 9))
-;;         (should (eq (prop-match-value match) 'val)))
-;;       (should (null (text-property-search-backward 'prop)))
-;;       (goto-char (point-max))
-;;       (should (null (text-property-search-backward 'non-existant)))))
-;;   (with-temp-buffer
-;;     (insert "one "
-;;             (propertize "two " 'prop 'val)
-;;             "three "
-;;             (propertize "four " 'prop 'wert)
-;;             "five ")
-;;     (goto-char (point-max))
-;;     (let ((match (compat--t-text-property-search-backward 'prop)))
-;;       (should (eq (compat--t-prop-match-beginning match) 15))
-;;       (should (eq (compat--t-prop-match-end match) 20))
-;;       (should (eq (compat--t-prop-match-value match) 'wert)))
-;;     (let ((match (compat--t-text-property-search-backward 'prop)))
-;;       (should (eq (compat--t-prop-match-beginning match) 5))
-;;       (should (eq (compat--t-prop-match-end match) 9))
-;;       (should (eq (compat--t-prop-match-value match) 'val)))
-;;     (should (null (compat--t-text-property-search-backward 'prop)))
-;;     (goto-char (point-max))
-;;     (should (null (compat--t-text-property-search-backward 
'non-existant)))))
-
 (provide 'compat-tests)
 ;;; compat-tests.el ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]