summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAdrian Thurston <thurston@complang.org>2015-02-12 16:48:05 -0500
committerAdrian Thurston <thurston@complang.org>2015-02-12 16:48:05 -0500
commita77f7d3b4be06c6a070bdba46847c646caa70a75 (patch)
tree585811441a276d3521ec99069370454696f36c4b /test
parent506049393a53781a389fb17b6010b863e5df5677 (diff)
downloadcolm-a77f7d3b4be06c6a070bdba46847c646caa70a75.tar.gz
added tests for list and map iteration
Diffstat (limited to 'test')
-rw-r--r--test/list2.lm17
-rw-r--r--test/map1.lm24
2 files changed, 41 insertions, 0 deletions
diff --git a/test/list2.lm b/test/list2.lm
new file mode 100644
index 00000000..e603bdbb
--- /dev/null
+++ b/test/list2.lm
@@ -0,0 +1,17 @@
+
+struct el
+ map_el<str> el
+end
+
+new M: map<str el>()
+
+for AE: argv_el in argv {
+ print "[AE->value]
+}
+
+##### ARGS #####
+a b c
+##### EXP #####
+a
+b
+c
diff --git a/test/map1.lm b/test/map1.lm
new file mode 100644
index 00000000..9d68c307
--- /dev/null
+++ b/test/map1.lm
@@ -0,0 +1,24 @@
+
+struct el
+ map_el<str> el
+end
+
+new M: map<str el>()
+
+AE: argv_el = argv->head
+while AE {
+ new El: el()
+ El->key = AE->value
+ M->insert( El )
+ AE = AE->next
+}
+
+for El: el in M {
+ print "[El->key]
+}
+##### ARGS #####
+a b c
+##### EXP #####
+a
+b
+c