string_replace_re added

This commit is contained in:
2021-10-24 11:23:44 +02:00
parent 4359012190
commit 79377476cb
5 changed files with 25 additions and 1 deletions

View File

@@ -69,6 +69,11 @@
(ut::define-test "result of (string-downcase \"abcABCD\")" '(ut::assert-equal "abcabcd" (string-downcase "abcABCD")))
(ut::define-test "result of (string-len \"abcdef\")" '(ut::assert-equal 6 (string-len "abcdef")))
(ut::define-test "result of (string-replace \"abcdef\" \"de\" \"DE\")" '(ut::assert-equal "abcDEfg" (string-replace "abcdefg" "de" "DE")))
(ut::define-test "result of (string-replace-re \"there is a subsequence in the string\" \"\\b(sub)([^ ]*)\" \"sub-$2\")" '(ut::assert-equal "there is a sub-sequence in the string" (string-replace-re "there is a subsequence in the string" "\\b(sub)([^ ]*)" "sub-$2")))
(ut::define-test "result of (string-replace-re \"XX<script>there is a subsequence in the string</script>YY<script>bbb</script>ZZ\" \"<script>(.*?)</script>\" \"\")" '(ut::assert-equal "XXYYZZ" (string-replace-re "XX<script>there is a subsequence in the string</script>YY<script>bbb</script>ZZ" "<script>(.*?)</script>" "")))
(ut::define-test "result of (string-substr \"ABCDEF\")" '(ut::assert-equal "ABCDEF" (string-substr "ABCDEF")))
(ut::define-test "result of (string-substr \"ABCDEF\" 1)" '(ut::assert-equal "BCDEF" (string-substr "ABCDEF" 1)))
(ut::define-test "result of (string-substr \"ABCDEF\" 2 3)" '(ut::assert-equal "CDE" (string-substr "ABCDEF" 2 3)))