aboutsummaryrefslogtreecommitdiffstats
path: root/test/src
diff options
context:
space:
mode:
Diffstat (limited to 'test/src')
-rw-r--r--test/src/fns-tests.el18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/src/fns-tests.el b/test/src/fns-tests.el
index f8554636bac..0301ceaad52 100644
--- a/test/src/fns-tests.el
+++ b/test/src/fns-tests.el
@@ -575,4 +575,22 @@
575 :type 'wrong-type-argument) 575 :type 'wrong-type-argument)
576 '(wrong-type-argument plistp (:foo 1 . :bar))))) 576 '(wrong-type-argument plistp (:foo 1 . :bar)))))
577 577
578(ert-deftest test-string-distance ()
579 "Test `string-distance' behavior."
580 ;; ASCII characters are always fine
581 (should (equal 1 (string-distance "heelo" "hello")))
582 (should (equal 2 (string-distance "aeelo" "hello")))
583 (should (equal 0 (string-distance "ab" "ab" t)))
584 (should (equal 1 (string-distance "ab" "abc" t)))
585
586 ;; string containing hanzi character, compare by byte
587 (should (equal 6 (string-distance "ab" "ab我她" t)))
588 (should (equal 3 (string-distance "ab" "a我b" t)))
589 (should (equal 3 (string-distance "我" "她" t)))
590
591 ;; string containing hanzi character, compare by character
592 (should (equal 2 (string-distance "ab" "ab我她")))
593 (should (equal 1 (string-distance "ab" "a我b")))
594 (should (equal 1 (string-distance "我" "她"))))
595
578(provide 'fns-tests) 596(provide 'fns-tests)