branch: externals/compat
commit 36003a503da60fe4c4970f9fe3a5ec398c663876
Author: Daniel Mendler <[email protected]>
Commit: Daniel Mendler <[email protected]>
Restore test
---
compat-tests.el | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/compat-tests.el b/compat-tests.el
index c229ee68b7..c4ebd8c031 100644
--- a/compat-tests.el
+++ b/compat-tests.el
@@ -68,6 +68,21 @@
(should (equal t (always 1))) ;; single argument
(should (equal t (always 1 2 3 4)))) ;; multiple arguments
+(ert-deftest string-width ()
+ (should (equal 0 (compat-call string-width "")))
+ (should (equal 3 (compat-call string-width "abc"))) ;; no
argument
+ (should (equal 5 (compat-call string-width "abcあ")))
+ (should (equal (1+ tab-width) (compat-call string-width "a ")))
+ (should (equal 2 (compat-call string-width "abc" 1))) ;; with
from
+ (should (equal 4 (compat-call string-width "abcあ" 1)))
+ (should (equal tab-width (compat-call string-width "a " 1)))
+ (should (equal 2 (compat-call string-width "abc" 0 2))) ;; with
to
+ (should (equal 3 (compat-call string-width "abcあ" 0 3)))
+ (should (equal 1 (compat-call string-width "a " 0 1)))
+ (should (equal 1 (compat-call string-width "abc" 1 2))) ;; with
from and to
+ (should (equal 2 (compat-call string-width "abcあ" 3 4)))
+ (should (equal 0 (compat-call string-width "a " 1 1))))
+
(ert-deftest compat-hash-table-keys ()
(let ((ht (make-hash-table)))
(should (null (hash-table-keys ht)))
@@ -538,21 +553,6 @@
;; (expect error "rel/" "ext")
;; (expect error "/abs/" "ext"))
-;; (compat-deftests compat-string-width
-;; (ought 0 "")
-;; (ought 3 "abc") ;no argument
-;; (ought 5 "abcあ")
-;; (ought (1+ tab-width) "a ")
-;; (ought 2 "abc" 1) ;with from
-;; (ought 4 "abcあ" 1)
-;; (ought tab-width "a " 1)
-;; (ought 2 "abc" 0 2) ;with to
-;; (ought 3 "abcあ" 0 3)
-;; (ought 1 "a " 0 1)
-;; (ought 1 "abc" 1 2) ;with from and to
-;; (ought 2 "abcあ" 3 4)
-;; (ought 0 "a " 1 1))
-
;; (compat-deftests flatten-tree
;; ;; Example from docstring:
;; (ought '(1 2 3 4 5 6 7) '(1 (2 . 3) nil (4 5 (6)) 7))