aboutsummaryrefslogtreecommitdiff
path: root/test/for.tm
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-04-12 13:09:31 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-04-12 13:09:31 -0400
commit6c01eef851439549018267fdc439e4884af0c624 (patch)
tree0599dd071b8a5effb67e6a87ed1c34777eb8d8c7 /test/for.tm
parent17cb6ffd88c4464c513b045f4b06c4e6e46e8f22 (diff)
Introducing the main() function
Diffstat (limited to 'test/for.tm')
-rw-r--r--test/for.tm37
1 files changed, 19 insertions, 18 deletions
diff --git a/test/for.tm b/test/for.tm
index 05990d37..51940973 100644
--- a/test/for.tm
+++ b/test/for.tm
@@ -7,11 +7,6 @@ func all_nums(nums:[Int])->Text
return "EMPTY"
return result
->> all_nums([10,20,30])
-= "10,20,30,"
->> all_nums([:Int])
-= "EMPTY"
-
func labeled_nums(nums:[Int])->Text
result := ""
for i,num in nums
@@ -20,11 +15,6 @@ func labeled_nums(nums:[Int])->Text
return "EMPTY"
return result
->> labeled_nums([10,20,30])
-= "1:10,2:20,3:30,"
->> labeled_nums([:Int])
-= "EMPTY"
-
func table_str(t:{Text=>Text})->Text
str := ""
for k,v in t
@@ -32,12 +22,6 @@ func table_str(t:{Text=>Text})->Text
else return "EMPTY"
return str
->> t := {"key1"=>"value1", "key2"=>"value2"}
->> table_str(t)
-= "key1=>value1,key2=>value2,"
->> table_str({:Text=>Text})
-= "EMPTY"
-
func table_key_str(t:{Text=>Text})->Text
str := ""
for k in t
@@ -45,5 +29,22 @@ func table_key_str(t:{Text=>Text})->Text
else return "EMPTY"
return str
->> table_key_str(t)
-= "key1,key2,"
+func main()
+ >> all_nums([10,20,30])
+ = "10,20,30,"
+ >> all_nums([:Int])
+ = "EMPTY"
+
+ >> labeled_nums([10,20,30])
+ = "1:10,2:20,3:30,"
+ >> labeled_nums([:Int])
+ = "EMPTY"
+
+ >> t := {"key1"=>"value1", "key2"=>"value2"}
+ >> table_str(t)
+ = "key1=>value1,key2=>value2,"
+ >> table_str({:Text=>Text})
+ = "EMPTY"
+
+ >> table_key_str(t)
+ = "key1,key2,"