aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/defer.tm4
-rw-r--r--test/lists.tm36
-rw-r--r--test/sets.tm13
-rw-r--r--test/structs.tm1
-rw-r--r--test/tables.tm12
5 files changed, 34 insertions, 32 deletions
diff --git a/test/defer.tm b/test/defer.tm
index 6c204851..8cab3122 100644
--- a/test/defer.tm
+++ b/test/defer.tm
@@ -6,8 +6,8 @@ func main()
nums.insert(x)
x = 999
- >> nums
- = @[123]
+ >> nums[]
+ = [123]
>> x
= 999
diff --git a/test/lists.tm b/test/lists.tm
index fef23f5d..f918b6f7 100644
--- a/test/lists.tm
+++ b/test/lists.tm
@@ -65,14 +65,14 @@ func main()
>> list := @[10, 20]
>> copy := list[]
>> list.insert(30)
- >> list
- = @[10, 20, 30]
+ >> list[]
+ = [10, 20, 30]
>> copy
= [10, 20]
>> list[1] = 999
- >> list
- = @[999, 20, 30]
+ >> list[]
+ = [999, 20, 30]
do
>> list := &[10, 20, 30]
@@ -88,19 +88,19 @@ func main()
# Sorted function doesn't mutate original:
>> nums.sorted()
= [-20, 10, 30]
- >> nums
- = @[10, -20, 30]
+ >> nums[]
+ = [10, -20, 30]
# Sort function does mutate in place:
>> nums.sort()
- >> nums
- = @[-20, 10, 30]
+ >> nums[]
+ = [-20, 10, 30]
# Custom sort functions:
>> nums.sort(func(x,y:&Int) x.abs() <> y.abs())
- >> nums
- = @[10, -20, 30]
+ >> nums[]
+ = [10, -20, 30]
>> nums.sort(func(x,y:&Int) y[] <> x[])
- >> nums
- = @[30, 10, -20]
+ >> nums[]
+ = [30, 10, -20]
>> ["A", "B", "C"].sample(10, [1.0, 0.5, 0.0])
@@ -175,14 +175,14 @@ func main()
>> nums := &[10, 20, 30, 40, 50]
>> nums.pop()
= 50?
- >> nums
- = &[10, 20, 30, 40]
+ >> nums[]
+ = [10, 20, 30, 40]
>> nums.pop(2)
= 20?
- >> nums
- = &[10, 30, 40]
+ >> nums[]
+ = [10, 30, 40]
>> nums.clear()
- >> nums
- = &[]
+ >> nums[]
+ = []
>> nums.pop()
= none
diff --git a/test/sets.tm b/test/sets.tm
index 85e53463..b30c2ce3 100644
--- a/test/sets.tm
+++ b/test/sets.tm
@@ -1,7 +1,8 @@
func main()
- >> t1 := @|10, 20, 30, 10|
- = @|10, 20, 30|
+ t1 := @|10, 20, 30, 10|
+ >> t1[]
+ = |10, 20, 30|
>> t1.has(10)
= yes
>> t1.has(-999)
@@ -29,11 +30,11 @@ func main()
= no
>> t1.add_all(t2)
- >> t1
- = @|10, 20, 30, 40|
+ >> t1[]
+ = |10, 20, 30, 40|
>> t1.remove_all(t2)
- >> t1
- = @|10, 20|
+ >> t1[]
+ = |10, 20|
>> |3, i for i in 5|
= |3, 1, 2, 4, 5|
diff --git a/test/structs.tm b/test/structs.tm
index a58a9ef7..40c1b566 100644
--- a/test/structs.tm
+++ b/test/structs.tm
@@ -63,6 +63,7 @@ func main()
>> @LinkedList(10, @LinkedList(20))
>> my_pass := Password("Swordfish")
+ = Password("Swordfish")
>> "$my_pass"
= "Password(...)"
>> users_by_password := {my_pass="User1", Password("xxx")="User2"}
diff --git a/test/tables.tm b/test/tables.tm
index 2254a7a0..1f4244f9 100644
--- a/test/tables.tm
+++ b/test/tables.tm
@@ -59,8 +59,8 @@ func main()
>> t3 := @{1=10, 2=20, 3=30}
>> t3.remove(3)
- >> t3
- = @{1=10, 2=20}
+ >> t3[]
+ = {1=10, 2=20}
do
>> plain := {1=10, 2=20, 3=30}
@@ -85,8 +85,8 @@ func main()
>> t4 := &{"one"= 1}
>> t4["one"] = 999
>> t4["two"] = 222
- >> t4
- = &{"one"=999, "two"=222}
+ >> t4[]
+ = {"one"=999, "two"=222}
do
assert {1=1, 2=2} == {2=2, 1=1}
@@ -114,5 +114,5 @@ func main()
>> counter["y"] += 1
>> counter
- >> counter
- = &{"x"=10, "y"=1; default=0}
+ >> counter[]
+ = {"x"=10, "y"=1; default=0}