]> git.eshelyaron.com Git - emacs.git/commitdiff
; * test/lisp/subr-tests.el (string-replace): Add more test cases
authorMattias Engdegård <mattiase@acm.org>
Sun, 27 Sep 2020 11:32:27 +0000 (13:32 +0200)
committerMattias Engdegård <mattiase@acm.org>
Sun, 27 Sep 2020 11:32:27 +0000 (13:32 +0200)
test/lisp/subr-tests.el

index 42dcf382e4040dbb15559021822604ac326262b1..035c064d75c22e73fa195cce69da5a72d1fdfc7a 100644 (file)
@@ -468,6 +468,19 @@ See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=19350."
                  "axb"))
   (should (equal (string-replace "\377" "x" "a\377ø")
                  "axø"))
+  (should (equal (string-replace (string-to-multibyte "\377") "x" "a\377b")
+                 "axb"))
+  (should (equal (string-replace (string-to-multibyte "\377") "x" "a\377ø")
+                 "axø"))
+
+  (should (equal (string-replace "ana" "ANA" "ananas") "ANAnas"))
+
+  (should (equal (string-replace "a" "" "") ""))
+  (should (equal (string-replace "a" "" "aaaaa") ""))
+  (should (equal (string-replace "ab" "" "ababab") ""))
+  (should (equal (string-replace "ab" "" "abcabcabc") "ccc"))
+  (should (equal (string-replace "a" "aa" "aaa") "aaaaaa"))
+  (should (equal (string-replace "abc" "defg" "abc") "defg"))
 
   (should-error (string-replace "" "x" "abc")))