[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/compat 95a35c15de 4/6: prop-match tests
From: |
ELPA Syncer |
Subject: |
[elpa] externals/compat 95a35c15de 4/6: prop-match tests |
Date: |
Wed, 4 Jan 2023 18:57:26 -0500 (EST) |
branch: externals/compat
commit 95a35c15debc1f0efebf1cdf0129e2c01ea194ca
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
prop-match tests
---
compat-27.el | 14 +++++++-------
compat-tests.el | 17 +++++++++++++++++
2 files changed, 24 insertions(+), 7 deletions(-)
diff --git a/compat-27.el b/compat-27.el
index 43cfabbfb5..5edcb6d36a 100644
--- a/compat-27.el
+++ b/compat-27.el
@@ -721,7 +721,7 @@ The return value is a string (or nil in case we can’t find
it)."
;;;; Defined in text-property-search.el
-(compat-defun make-prop-match (&rest attr) ;; <UNTESTED>
+(compat-defun make-prop-match (&rest attr) ;; <OK>
"Constructor for objects of type ‘prop-match’."
:max-version "26.1"
:feature text-property-search
@@ -731,7 +731,7 @@ The return value is a string (or nil in case we can’t find
it)."
(plist-get attr :end)
(plist-get attr :value)))
-(compat-defun make-prop-match (&rest attr) ;; <UNTESTED>
+(compat-defun make-prop-match (&rest attr) ;; <OK>
"Constructor for objects of type ‘prop-match’."
:min-version "26.1"
:feature text-property-search
@@ -741,29 +741,29 @@ The return value is a string (or nil in case we can’t
find it)."
(plist-get attr :end)
(plist-get attr :value)))
-(compat-defun prop-match-p (match) ;; <UNTESTED>
+(compat-defun prop-match-p (match) ;; <OK>
"Return non-nil if MATCH is a `prop-match' object."
:max-version "26.1"
:feature text-property-search
(and (vectorp match) (eq (aref match 0) 'prop-match))) ;; Vector
-(compat-defun prop-match-p (match) ;; <UNTESTED>
+(compat-defun prop-match-p (match) ;; <OK>
"Return non-nil if MATCH is a `prop-match' object."
:min-version "26.1"
:feature text-property-search
(eq (type-of match) 'prop-match)) ;; Record
-(compat-defun prop-match-beginning (match) ;; <UNTESTED>
+(compat-defun prop-match-beginning (match) ;; <OK>
"Retrieve the position where MATCH begins."
:feature text-property-search
(aref match 1))
-(compat-defun prop-match-end (match) ;; <UNTESTED>
+(compat-defun prop-match-end (match) ;; <OK>
"Retrieve the position where MATCH ends."
:feature text-property-search
(aref match 2))
-(compat-defun prop-match-value (match) ;; <UNTESTED>
+(compat-defun prop-match-value (match) ;; <OK>
"Retrieve the value that MATCH holds."
:feature text-property-search
(aref match 3))
diff --git a/compat-tests.el b/compat-tests.el
index 8892ec508a..2d830e08cd 100644
--- a/compat-tests.el
+++ b/compat-tests.el
@@ -1534,6 +1534,19 @@
(json-insert '((:key . ["abc" 2]) (yek . t)))
(should-equal (buffer-string) "{\":key\":[\"abc\",2],\"yek\":true}")))
+(ert-deftest make-prop-match ()
+ (should (prop-match-p (make-prop-match)))
+ (should (prop-match-p (make-prop-match :end 1)))
+ (should (prop-match-p (make-prop-match :beginning 1 :end 2 :value 3)))
+ (should-equal 1 (prop-match-beginning (make-prop-match :beginning 1 :end 2
:value 3)))
+ (should-equal 2 (prop-match-end (make-prop-match :beginning 1 :end 2 :value
3)))
+ (should-equal 3 (prop-match-value (make-prop-match :beginning 1 :end 2
:value 3)))
+ (should-not (prop-match-p nil))
+ (should-not (prop-match-p []))
+ (should-not (prop-match-p 'symbol))
+ (should-not (prop-match-p "string"))
+ (should-not (prop-match-p '(1 2 3))))
+
(ert-deftest text-property-search-forward ()
(with-temp-buffer
(insert "one "
@@ -1543,10 +1556,12 @@
"five ")
(goto-char (point-min))
(let ((match (text-property-search-forward 'prop)))
+ (should (prop-match-p match))
(should-equal (prop-match-beginning match) 5)
(should-equal (prop-match-end match) 9)
(should-equal (prop-match-value match) 'val))
(let ((match (text-property-search-forward 'prop)))
+ (should (prop-match-p match))
(should-equal (prop-match-beginning match) 15)
(should-equal (prop-match-end match) 20)
(should-equal (prop-match-value match) 'wert))
@@ -1563,10 +1578,12 @@
"five ")
(goto-char (point-max))
(let ((match (text-property-search-backward 'prop)))
+ (should (prop-match-p match))
(should-equal (prop-match-beginning match) 15)
(should-equal (prop-match-end match) 20)
(should-equal (prop-match-value match) 'wert))
(let ((match (text-property-search-backward 'prop)))
+ (should (prop-match-p match))
(should-equal (prop-match-beginning match) 5)
(should-equal (prop-match-end match) 9)
(should-equal (prop-match-value match) 'val))
- [elpa] externals/compat updated (fecfefef40 -> 4aab3bd2cc), ELPA Syncer, 2023/01/04
- [elpa] externals/compat 95a35c15de 4/6: prop-match tests,
ELPA Syncer <=
- [elpa] externals/compat 4aab3bd2cc 6/6: Remove nadvice from Package-Requires, ELPA Syncer, 2023/01/04
- [elpa] externals/compat 47475cacfa 3/6: proper-list-p: Use simpler definition from org-compat, ELPA Syncer, 2023/01/04
- [elpa] externals/compat 0cb53e517f 5/6: Fix prop-match-p, ELPA Syncer, 2023/01/04
- [elpa] externals/compat 2e6f7b14ae 1/6: Add ignore-error test, ELPA Syncer, 2023/01/04
- [elpa] externals/compat 21533c286e 2/6: Add function-put test, ELPA Syncer, 2023/01/04