string regex function added
This commit is contained in:
@@ -62,18 +62,21 @@
|
||||
(ut::define-test "result of (string-rtrim \"abc \")" '(ut::assert-equal "abc" (string-rtrim "abc ")))
|
||||
(ut::define-test "result of (string-ltrim \" abc\")" '(ut::assert-equal "abc" (string-ltrim " abc")))
|
||||
(ut::define-test "result of (string-trim \" abc \")" '(ut::assert-equal "abc" (string-trim " abc ")))
|
||||
(ut::define-test "result of (string-regex? \"test.lsp\" \"^.*\.l(i)?sp$\")" '(ut::assert-true (string-regex? "test.lsp" "^.*\.l(i)?sp$")))
|
||||
|
||||
(ut::define-test "result of (string-split \"split me by space\" \"\\s+\")" '(ut::assert-equal '("split" "me" "by" "space") (string-split "split me by space" "\\s+")))
|
||||
(ut::define-test "result of (string-upcase \"abcABCD\")" '(ut::assert-equal "ABCABCD" (string-upcase "abcABCD")))
|
||||
(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-split \"split me by space\" \"\\s+\")" '(ut::assert-equal '("split" "me" "by" "space") (string-split "split me by space" "\\s+")))
|
||||
|
||||
(ut::define-test "result of (string-regex? \"test.lsp\" \"^.*\.l(i)?sp$\")" '(ut::assert-true (string-regex? "test.lsp" "^.*\.l(i)?sp$")))
|
||||
(ut::define-test "result of (string-regex-list ... \"match\")" (ut::assert-equal '(("<td class=\"xyz\">1</td>" "<td>2</td>")) (string-regex-list "<td class=\"xyz\">1</td><td>2</td>" "<td.*?>(.*?)</td>" "match" "ignore")))
|
||||
(ut::define-test "result of (string-regex-list ... \"token\")" '(ut::assert-equal '(("1") ("2")) (string-regex-list "<td class=\"xyz\">1</td><td>2</td>" "<td.*?>(.*?)</td>" "token")))
|
||||
|
||||
(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)))
|
||||
|
||||
Reference in New Issue
Block a user