summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2016-09-17 11:02:04 -0700
committerKaz Kylheku <kaz@kylheku.com>2016-09-17 11:02:04 -0700
commit6a61ffbabf4a3c5616c5fbf30c7dff7b1af4dd39 (patch)
tree4fbba2a22e96bf2b55bc3071b3fe4c1426f3c3ea /tests
parent972d095787d6107141004a66f8e5c86b89f446c6 (diff)
downloadtxr-6a61ffbabf4a3c5616c5fbf30c7dff7b1af4dd39.tar.gz
txr-6a61ffbabf4a3c5616c5fbf30c7dff7b1af4dd39.tar.bz2
txr-6a61ffbabf4a3c5616c5fbf30c7dff7b1af4dd39.zip
Tests for tok-str.
* tests/015/split.tl: New cases added.
Diffstat (limited to 'tests')
-rw-r--r--tests/015/split.expected0
-rw-r--r--tests/015/split.tl73
2 files changed, 73 insertions, 0 deletions
diff --git a/tests/015/split.expected b/tests/015/split.expected
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/015/split.expected
diff --git a/tests/015/split.tl b/tests/015/split.tl
index df496170..30a8e01c 100644
--- a/tests/015/split.tl
+++ b/tests/015/split.tl
@@ -121,3 +121,76 @@
(mtest
(split-str "abcacabcac" #/ab?/) ("" "c" "c" "c" "c")
(split-str "abcacabcac" #/ab?/ t) ("" "ab" "c" "a" "c" "ab" "c" "a" "c"))
+
+(mtest
+ (tok-str "" #//) nil
+ (tok-str "a" #//) nil
+ (tok-str "" #/a/) nil
+ (tok-str "a" #/a/) ("a"))
+
+(mtest
+ (tok-str "" #// t) ("")
+ (tok-str "a" #// t) ("a")
+ (tok-str "" #/a/ t) ("")
+ (tok-str "a" #/a/ t) ("" "a" ""))
+
+(mtest
+ (tok-str "ab" #//) ("")
+ (tok-str "ab" #/a/) ("a")
+ (tok-str "ab" #/b/) ("b")
+ (tok-str "ab" #/ab/) ("ab")
+ (tok-str "ab" #/abc/) nil)
+
+(mtest
+ (tok-str "ab" #// t) ("a" "" "b")
+ (tok-str "ab" #/a/ t) ("" "a" "b")
+ (tok-str "ab" #/b/ t) ("a" "b" "")
+ (tok-str "ab" #/ab/ t) ("" "ab" "")
+ (tok-str "ab" #/abc/ t) ("ab"))
+
+(mtest
+ (tok-str "abc" #//) ("" "")
+ (tok-str "abc" #// t) ("a" "" "b" "" "c"))
+
+(mtest
+ (tok-str "abc" #/a/) ("a")
+ (tok-str "abc" #/b/) ("b")
+ (tok-str "abc" #/c/) ("c")
+ (tok-str "abc" #/a/ t) ("" "a" "bc")
+ (tok-str "abc" #/b/ t) ("a" "b" "c")
+ (tok-str "abc" #/c/ t) ("ab" "c" ""))
+
+(mtest
+ (tok-str "abc" #/ab/) ("ab")
+ (tok-str "abc" #/bc/) ("bc")
+ (tok-str "abc" #/abc/) ("abc")
+ (tok-str "abc" #/ab/ t) ("" "ab" "c")
+ (tok-str "abc" #/bc/ t) ("a" "bc" "")
+ (tok-str "abc" #/abc/ t) ("" "abc" ""))
+
+(mtest
+ (tok-str "a,b,c" #/,/ t) ("a" "," "b" "," "c")
+ (tok-str ",b,c" #/,/ t) ("" "," "b" "," "c")
+ (tok-str "a,,c" #/,/ t) ("a" "," "" "," "c")
+ (tok-str "a,b," #/,/ t) ("a" "," "b" "," "")
+ (tok-str ",,c" #/,/ t) ("" "," "" "," "c")
+ (tok-str "a,," #/,/ t) ("a" "," "" "," "")
+ (tok-str ",," #/,/ t) ("" "," "" "," ""))
+
+(mtest
+ (tok-str "a,b,c" #/[^,]/) #"a b c"
+ (tok-str "a,b,c" #/[^,]/ t) ("" "a" "," "b" "," "c" "")
+ (tok-str "a,b,c" #/[^a-c]/) #", ,"
+ (tok-str "a,b,c" #/[^a-c]/ t) #"a , b , c")
+
+(mtest
+ (tok-str "abc" #/./) #"a b c"
+ (tok-str "abc" #/./ t) ("" "a" "" "b" "" "c" "")
+ (tok-str "abc" #/../) #"ab"
+ (tok-str "abc" #/../ t) ("" "ab" "c")
+ (tok-str "abc" #/.../) #"abc"
+ (tok-str "abc" #/.../ t) ("" "abc" ""))
+
+(mtest
+ (tok-str "abcacabcac" #/ab?/) #"ab a ab a"
+ (tok-str "abcacabcac" #/ab?/ t) ("" "ab" "c" "a" "c" "ab" "c" "a" "c"))