summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2013-12-12 02:07:12 -0500
committerOri Bernstein <ori@eigenstate.org>2013-12-12 02:07:12 -0500
commitb7b99ac74c22eaf17e89c79327c0c32f991ce089 (patch)
tree0aee6424f3a82c4f03cb5c6cc79a0876973d17ea /test
parentd1ff1cf60286cc672d269eaeef62c1bd3134d408 (diff)
downloadmc-b7b99ac74c22eaf17e89c79327c0c32f991ce089.tar.gz
Add more stdlib tests.
Diffstat (limited to 'test')
-rw-r--r--test/data/strsplit-expected4
-rw-r--r--test/data/strstrip-expected15
-rw-r--r--test/strsplit.myr12
-rw-r--r--test/tests2
4 files changed, 33 insertions, 0 deletions
diff --git a/test/data/strsplit-expected b/test/data/strsplit-expected
new file mode 100644
index 0000000..d68dd40
--- /dev/null
+++ b/test/data/strsplit-expected
@@ -0,0 +1,4 @@
+a
+b
+c
+d
diff --git a/test/data/strstrip-expected b/test/data/strstrip-expected
new file mode 100644
index 0000000..ab34c59
--- /dev/null
+++ b/test/data/strstrip-expected
@@ -0,0 +1,15 @@
+"abc"
+"abc "
+" abc"
+--
+"世界"
+"世界 "
+" 世界"
+--
+""
+""
+""
+--
+""
+""
+""
diff --git a/test/strsplit.myr b/test/strsplit.myr
new file mode 100644
index 0000000..d6fec93
--- /dev/null
+++ b/test/strsplit.myr
@@ -0,0 +1,12 @@
+use std
+
+const main = {
+ var i
+ var sp
+
+ sp = std.strsplit("a,b,c,d", ",")
+ for i = 0; i < sp.len; i++
+ std.put("%s\n", sp[i])
+ ;;
+ -> 0
+}
diff --git a/test/tests b/test/tests
index 8dcef5d..aa27a0b 100644
--- a/test/tests
+++ b/test/tests
@@ -104,6 +104,8 @@ B helloworld P Hello-世界
B encodechar P 1世界äa
B strtab C
B catfile C
+B strstrip C
+B strsplit C
# B local-labels E 10 ## BUGGERED
F declmismatch
F infermismatch