aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/for.tm8
-rw-r--r--test/lang.tm10
-rw-r--r--test/serialization.tm4
-rw-r--r--test/structs.tm4
-rw-r--r--test/tables.tm54
-rw-r--r--test/text.tm2
6 files changed, 41 insertions, 41 deletions
diff --git a/test/for.tm b/test/for.tm
index ae5f786e..e3774815 100644
--- a/test/for.tm
+++ b/test/for.tm
@@ -15,14 +15,14 @@ func labeled_nums(nums:[Int] -> Text):
return "EMPTY"
return result
-func table_str(t:{Text:Text} -> Text):
+func table_str(t:{Text,Text} -> Text):
str := ""
for k,v in t:
str ++= "$k:$v,"
else: return "EMPTY"
return str
-func table_key_str(t:{Text:Text} -> Text):
+func table_key_str(t:{Text,Text} -> Text):
str := ""
for k in t:
str ++= "$k,"
@@ -40,10 +40,10 @@ func main():
>> labeled_nums([:Int])
= "EMPTY"
- >> t := {"key1":"value1", "key2":"value2"}
+ >> t := {"key1"="value1", "key2"="value2"}
>> table_str(t)
= "key1:value1,key2:value2,"
- >> table_str({:Text:Text})
+ >> table_str({:Text,Text})
= "EMPTY"
>> table_key_str(t)
diff --git a/test/lang.tm b/test/lang.tm
index 451ec480..c0add87b 100644
--- a/test/lang.tm
+++ b/test/lang.tm
@@ -2,11 +2,11 @@ lang HTML:
HEADER := $HTML"<!DOCTYPE HTML>"
func escape(t:Text->HTML):
t = t:replace_all({
- $/&/: "&amp;",
- $/</: "&lt;",
- $/>/: "&gt;",
- $/"/: "&quot",
- $/'/: "&#39;",
+ $/&/="&amp;",
+ $/</="&lt;",
+ $/>/="&gt;",
+ $/"/="&quot",
+ $/'/="&#39;",
})
return HTML.without_escaping(t)
diff --git a/test/serialization.tm b/test/serialization.tm
index a442d9e2..433caab3 100644
--- a/test/serialization.tm
+++ b/test/serialization.tm
@@ -57,9 +57,9 @@ func main():
= yes
do:
- >> obj := {"A":10, "B":20; fallback={"C":30}}
+ >> obj := {"A"=10, "B"=20; fallback={"C"=30}}
>> bytes := obj:serialized()
- >> deserialize(bytes -> {Text:Int}) == obj
+ >> deserialize(bytes -> {Text,Int}) == obj
= yes
do:
diff --git a/test/structs.tm b/test/structs.tm
index de220b11..739b5529 100644
--- a/test/structs.tm
+++ b/test/structs.tm
@@ -72,8 +72,8 @@ func main():
>> my_pass := Password("Swordfish")
= Password(...)
- >> users_by_password := {my_pass:"User1", Password("xxx"):"User2"}
- = {Password(...):"User1", Password(...):"User2"}
+ >> users_by_password := {my_pass="User1", Password("xxx")="User2"}
+ = {Password(...)="User1", Password(...)="User2"}
>> users_by_password[my_pass]!
= "User1"
diff --git a/test/tables.tm b/test/tables.tm
index 6abbbe36..c97c35a0 100644
--- a/test/tables.tm
+++ b/test/tables.tm
@@ -1,6 +1,6 @@
func main():
- >> t := {"one":1, "two":2}
- = {"one":1, "two":2}
+ >> t := {"one"=1, "two"=2}
+ = {"one"=1, "two"=2}
>> t["one"]
= 1 : Int?
@@ -15,22 +15,22 @@ func main():
t_str := ""
for k,v in t:
- t_str ++= "($k:$v)"
+ t_str ++= "($k=$v)"
>> t_str
- = "(one:1)(two:2)"
+ = "(one=1)(two=2)"
>> t.length
= 2
>> t.fallback
- = none : {Text:Int}?
+ = none : {Text,Int}?
>> t.keys
= ["one", "two"]
>> t.values
= [1, 2]
- >> t2 := {"three":3; fallback=t}
- = {"three":3; fallback={"one":1, "two":2}}
+ >> t2 := {"three"=3; fallback=t}
+ = {"three"=3; fallback={"one"=1, "two"=2}}
>> t2["one"]
= 1 : Int?
@@ -42,28 +42,28 @@ func main():
>> t2.length
= 1
>> t2.fallback
- = {"one":1, "two":2} : {Text:Int}?
+ = {"one"=1, "two"=2} : {Text,Int}?
t2_str := ""
for k,v in t2:
- t2_str ++= "($k:$v)"
+ t2_str ++= "($k=$v)"
>> t2_str
- = "(three:3)"
+ = "(three=3)"
- >> {i:10*i for i in 5}
- = {1:10, 2:20, 3:30, 4:40, 5:50}
- >> {i:10*i for i in 5 if i mod 2 != 0}
- = {1:10, 3:30, 5:50}
- >> {x:10*x for x in y if x > 1 for y in [3, 4, 5] if y < 5}
- = {2:20, 3:30, 4:40}
+ >> {i=10*i for i in 5}
+ = {1=10, 2=20, 3=30, 4=40, 5=50}
+ >> {i=10*i for i in 5 if i mod 2 != 0}
+ = {1=10, 3=30, 5=50}
+ >> {x=10*x for x in y if x > 1 for y in [3, 4, 5] if y < 5}
+ = {2=20, 3=30, 4=40}
- >> t3 := @{1:10, 2:20, 3:30}
+ >> t3 := @{1=10, 2=20, 3=30}
>> t3:remove(3)
>> t3
- = @{1:10, 2:20}
+ = @{1=10, 2=20}
do:
- >> plain := {1:10, 2:20, 3:30}
+ >> plain := {1=10, 2=20, 3=30}
>> plain[2]!
= 20
>> plain[2]!
@@ -75,29 +75,29 @@ func main():
>> plain:has(456)
= no
- >> fallback := {4:40; fallback=plain}
+ >> fallback := {4=40; fallback=plain}
>> fallback:has(1)
= yes
>> fallback[1] or -999
= 10
do:
- >> t4 := &{"one": 1}
+ >> t4 := &{"one"= 1}
>> t4["one"] = 999
>> t4["two"] = 222
>> t4
- = &{"one":999, "two":222}
+ = &{"one"=999, "two"=222}
do:
- >> {1:1, 2:2} == {2:2, 1:1}
+ >> {1=1, 2=2} == {2=2, 1=1}
= yes
- >> {1:1, 2:2} == {1:1, 2:999}
+ >> {1=1, 2=2} == {1=1, 2=999}
= no
- >> {1:1, 2:2} <> {2:2, 1:1}
+ >> {1=1, 2=2} <> {2=2, 1=1}
= 0
- >> [{:Int:Int}, {0:0}, {99:99}, {1:1, 2:2, 3:3}, {1:1, 99:99, 3:3}, {1:1, 2:-99, 3:3}, {1:1, 99:-99, 3:4}]:sorted()
- = [{}, {0:0}, {1:1, 2:-99, 3:3}, {1:1, 2:2, 3:3}, {1:1, 99:99, 3:3}, {1:1, 99:-99, 3:4}, {99:99}]
+ >> [{:Int,Int}, {0=0}, {99=99}, {1=1, 2=2, 3=3}, {1=1, 99=99, 3=3}, {1=1, 2=-99, 3=3}, {1=1, 99=-99, 3=4}]:sorted()
+ = [{}, {0=0}, {1=1, 2=-99, 3=3}, {1=1, 2=2, 3=3}, {1=1, 99=99, 3=3}, {1=1, 99=-99, 3=4}, {99=99}]
>> [{:Int}, {1}, {2}, {99}, {0, 3}, {1, 2}, {99}]:sorted()
= [{}, {0, 3}, {1}, {1, 2}, {2}, {99}, {99}]
diff --git a/test/text.tm b/test/text.tm
index 13ee2a3b..9edeee07 100644
--- a/test/text.tm
+++ b/test/text.tm
@@ -241,7 +241,7 @@ func main():
>> " foo(xyz) foo(yyy) foo(z()) ":replace($/foo(?)/, "baz(\1)")
= " baz(xyz) baz(yyy) baz(z()) "
- >> "<tag>":replace_all({$/</:"&lt;", $/>/:"&gt;"})
+ >> "<tag>":replace_all({$/</="&lt;", $/>/="&gt;"})
= "&lt;tag&gt;"
>> " BAD(x, fn(y), BAD(z), w) ":replace($/BAD(?)/, "good(\1)", recursive=yes)