aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/arrays.tm4
-rw-r--r--test/iterators.tm4
-rw-r--r--test/nums.tm8
-rw-r--r--test/optionals.tm70
-rw-r--r--test/paths.tm4
-rw-r--r--test/reductions.tm4
-rw-r--r--test/serialization.tm4
-rw-r--r--test/structs.tm4
-rw-r--r--test/tables.tm6
-rw-r--r--test/text.tm14
10 files changed, 62 insertions, 60 deletions
diff --git a/test/arrays.tm b/test/arrays.tm
index 0d21ea1d..f59ed6ce 100644
--- a/test/arrays.tm
+++ b/test/arrays.tm
@@ -162,9 +162,9 @@ func main():
>> ["a", "b", "c"]:find("b")
= 2 : Int?
>> ["a", "b", "c"]:find("XXX")
- = NONE : Int?
+ = none : Int?
>> [10, 20]:first(func(i:&Int): i:is_prime())
- = NONE : Int?
+ = none : Int?
>> [4, 5, 6]:first(func(i:&Int): i:is_prime())
= 2 : Int?
diff --git a/test/iterators.tm b/test/iterators.tm
index ebb040fd..4a85e6f9 100644
--- a/test/iterators.tm
+++ b/test/iterators.tm
@@ -4,7 +4,7 @@ struct Pair(x:Text, y:Text)
func pairwise(strs:[Text] -> func(->Pair?)):
i := 1
return func():
- if i + 1 > strs.length: return NONE:Pair
+ if i + 1 > strs.length: return none:Pair
i += 1
return Pair(strs[i-1], strs[i])?
@@ -12,7 +12,7 @@ func range(first:Int, last:Int -> func(->Int?)):
i := first
return func():
if i > last:
- return NONE:Int
+ return none:Int
i += 1
return (i-1)?
diff --git a/test/nums.tm b/test/nums.tm
index 3a66ffe3..1192826f 100644
--- a/test/nums.tm
+++ b/test/nums.tm
@@ -22,8 +22,8 @@ func main():
>> Num.INF:isinf()
= yes
- >> nan := NONE : Num
- = NONE : Num?
+ >> nan := none : Num
+ = none : Num?
>> nan == nan
= yes
>> nan < nan
@@ -46,10 +46,10 @@ func main():
= -1
>> nan + 1
- = NONE : Num?
+ = none : Num?
>> 0./0.
- = NONE : Num?
+ = none : Num?
>> Num.PI:cos()!:near(-1)
= yes
diff --git a/test/optionals.tm b/test/optionals.tm
index acefdd2a..2ccdf392 100644
--- a/test/optionals.tm
+++ b/test/optionals.tm
@@ -4,81 +4,81 @@ struct Struct(x:Int, y:Text):
if should_i:
return Struct(123, "hello")
else:
- return NONE
+ return none
enum Enum(X, Y(y:Int)):
func maybe(should_i:Bool->Enum?):
if should_i:
return Enum.Y(123)
else:
- return NONE
+ return none
func maybe_int(should_i:Bool->Int?):
if should_i:
return 123
else:
- return NONE
+ return none
func maybe_int64(should_i:Bool->Int64?):
if should_i:
return Int64(123)
else:
- return NONE
+ return none
func maybe_array(should_i:Bool->[Int]?):
if should_i:
return [10, 20, 30]
else:
- return NONE
+ return none
func maybe_bool(should_i:Bool->Bool?):
if should_i:
return no
else:
- return NONE
+ return none
func maybe_text(should_i:Bool->Text?):
if should_i:
return "Hello"
else:
- return NONE
+ return none
func maybe_num(should_i:Bool->Num?):
if should_i:
return 12.3
else:
- return NONE
+ return none
func maybe_lambda(should_i:Bool-> func()?):
if should_i:
return func(): say("hi!")
else:
- return NONE
+ return none
func maybe_c_string(should_i:Bool->CString?):
if should_i:
return ("hi":as_c_string())?
else:
- return NONE
+ return none
func maybe_channel(should_i:Bool->|Int|?):
if should_i:
return |:Int|?
else:
- return NONE
+ return none
func maybe_thread(should_i:Bool->Thread?):
if should_i:
return Thread.new(func(): pass)
else:
- return NONE
+ return none
func main():
>> 5?
= 5 : Int?
>> if no:
- NONE:Int
+ none:Int
else:
5
= 5 : Int?
@@ -92,7 +92,7 @@ func main():
>> 5? or exit("Non-null is falsey")
= 5 : Int
- >> (NONE:Int) or -1
+ >> (none:Int) or -1
= -1 : Int
do:
@@ -100,7 +100,7 @@ func main():
>> yep := maybe_int(yes)
= 123 : Int?
>> nope := maybe_int(no)
- = NONE : Int?
+ = none : Int?
>> if yep:
>> yep
= 123
@@ -115,7 +115,7 @@ func main():
>> yep := maybe_int64(yes)
= 123 : Int64?
>> nope := maybe_int64(no)
- = NONE : Int64?
+ = none : Int64?
>> if yep:
>> yep
= 123
@@ -130,7 +130,7 @@ func main():
>> yep := maybe_array(yes)
= [10, 20, 30] : [Int]?
>> nope := maybe_array(no)
- = NONE : [Int]?
+ = none : [Int]?
>> if yep:
>> yep
= [10, 20, 30]
@@ -145,7 +145,7 @@ func main():
>> yep := maybe_bool(yes)
= no : Bool?
>> nope := maybe_bool(no)
- = NONE : Bool?
+ = none : Bool?
>> if yep:
>> yep
= no
@@ -160,7 +160,7 @@ func main():
>> yep := maybe_text(yes)
= "Hello" : Text?
>> nope := maybe_text(no)
- = NONE : Text?
+ = none : Text?
>> if yep:
>> yep
= "Hello"
@@ -175,7 +175,7 @@ func main():
>> yep := maybe_num(yes)
= 12.3 : Num?
>> nope := maybe_num(no)
- = NONE : Num?
+ = none : Num?
>> if yep:
>> yep
= 12.3
@@ -190,7 +190,7 @@ func main():
>> yep := maybe_lambda(yes)
= func() [optionals.tm:54] : func()?
>> nope := maybe_lambda(no)
- = NONE : func()?
+ = none : func()?
>> if yep:
>> yep
= func() [optionals.tm:54]
@@ -205,7 +205,7 @@ func main():
>> yep := Struct.maybe(yes)
= Struct(x=123, y="hello") : Struct?
>> nope := Struct.maybe(no)
- = NONE : Struct?
+ = none : Struct?
>> if yep:
>> yep
= Struct(x=123, y="hello")
@@ -220,7 +220,7 @@ func main():
>> yep := Enum.maybe(yes)
= Enum.Y(123) : Enum?
>> nope := Enum.maybe(no)
- = NONE : Enum?
+ = none : Enum?
>> if yep:
>> yep
= Enum.Y(123)
@@ -235,7 +235,7 @@ func main():
>> yep := maybe_c_string(yes)
= CString("hi") : CString?
>> nope := maybe_c_string(no)
- = NONE : CString?
+ = none : CString?
>> if yep:
>> yep
= CString("hi")
@@ -250,7 +250,7 @@ func main():
>> yep := maybe_channel(yes)
# No "=" test here because channels use addresses in the text version
>> nope := maybe_channel(no)
- = NONE : |:Int|?
+ = none : |:Int|?
>> if yep: >> yep
else: fail("Falsey: $yep")
>> if nope:
@@ -263,7 +263,7 @@ func main():
>> yep := maybe_thread(yes)
# No "=" test here because threads use addresses in the text version
>> nope := maybe_thread(no)
- = NONE : Thread?
+ = none : Thread?
>> if yep: >> yep
else: fail("Falsey: $yep")
>> if nope:
@@ -279,14 +279,16 @@ func main():
= 123 : Int
# Test comparisons, hashing, equality:
- >> (NONE:Int == 5?)
+ >> (none:Int == 5?)
= no
>> (5? == 5?)
= yes
- >> {NONE:Int, NONE:Int}
- = {NONE}
- >> [5?, NONE:Int, NONE:Int, 6?]:sorted()
- = [NONE, NONE, 5, 6]
+ >> {none:Int, none:Int}
+ = {none}
+ >> {:Int? none, none}
+ = {none}
+ >> [5?, none:Int, none:Int, 6?]:sorted()
+ = [none, none, 5, 6]
do:
>> value := if var := 5?:
@@ -296,7 +298,7 @@ func main():
= 5
do:
- >> value := if var := NONE:Int:
+ >> value := if var := none:Int:
var
else:
0
@@ -310,7 +312,7 @@ func main():
>> opt
do:
- >> opt := NONE:Int
+ >> opt := none:Int
>> if opt:
>> opt
else:
@@ -319,7 +321,7 @@ func main():
>> not 5?
= no
- >> not NONE:Int
+ >> not none:Int
= yes
>> [Struct(5,"A")?, Struct(6,"B"), Struct(7,"C")]
diff --git a/test/paths.tm b/test/paths.tm
index 25cb4e59..1a8da4cf 100644
--- a/test/paths.tm
+++ b/test/paths.tm
@@ -36,9 +36,9 @@ func main():
fail("Couldn't read lines in $tmpfile")
>> (./does-not-exist.xxx):read()
- = NONE : Text?
+ = none : Text?
>> (./does-not-exist.xxx):read_bytes()
- = NONE : [Byte]?
+ = none : [Byte]?
if lines := (./does-not-exist.xxx):by_line():
fail("I could read lines in a nonexistent file")
else:
diff --git a/test/reductions.tm b/test/reductions.tm
index 26f3533c..7ab95779 100644
--- a/test/reductions.tm
+++ b/test/reductions.tm
@@ -5,7 +5,7 @@ func main():
= 60 : Int?
>> (+: [:Int])
- = NONE : Int?
+ = none : Int?
>> (+: [10, 20, 30]) or 0
= 60
@@ -37,7 +37,7 @@ func main():
= yes
>> (<=: [:Int])
- = NONE : Bool?
+ = none : Bool?
>> (<=: [5, 4, 3, 2, 1])!
= no
diff --git a/test/serialization.tm b/test/serialization.tm
index da79f1b7..a442d9e2 100644
--- a/test/serialization.tm
+++ b/test/serialization.tm
@@ -1,5 +1,5 @@
-struct Foo(name:Text, next=NONE:@Foo)
+struct Foo(name:Text, next=none:@Foo)
enum MyEnum(Zero, One(x:Int), Two(x:Num, y:Text))
@@ -88,7 +88,7 @@ func main():
= yes
do:
- >> obj := NONE:Num
+ >> obj := none:Num
>> bytes := obj:serialized()
>> deserialize(bytes -> Num?) == obj
= yes
diff --git a/test/structs.tm b/test/structs.tm
index afbb1a86..de220b11 100644
--- a/test/structs.tm
+++ b/test/structs.tm
@@ -2,11 +2,11 @@
struct Single(x:Int)
struct Pair(x,y:Int)
struct Mixed(x:Int, text:Text)
-struct LinkedList(x:Int, next=NONE:@LinkedList)
+struct LinkedList(x:Int, next=none:@LinkedList)
struct Password(text:Text; secret)
struct CorecursiveA(other:@CorecursiveB?)
-struct CorecursiveB(other=NONE:@CorecursiveA)
+struct CorecursiveB(other=none:@CorecursiveA)
func test_literals():
>> Single(123)
diff --git a/test/tables.tm b/test/tables.tm
index 0d8954a2..403f25e2 100644
--- a/test/tables.tm
+++ b/test/tables.tm
@@ -7,7 +7,7 @@ func main():
>> t["two"]
= 2 : Int?
>> t["???"]
- = NONE : Int?
+ = none : Int?
>> t["one"]!
= 1
>> t["???"] or -1
@@ -22,7 +22,7 @@ func main():
>> t.length
= 2
>> t.fallback
- = NONE : {Text:Int}?
+ = none : {Text:Int}?
>> t.keys
= ["one", "two"]
@@ -37,7 +37,7 @@ func main():
>> t2["three"]
= 3 : Int?
>> t2["???"]
- = NONE : Int?
+ = none : Int?
>> t2.length
= 1
diff --git a/test/text.tm b/test/text.tm
index c6fb6ad7..26fd4c63 100644
--- a/test/text.tm
+++ b/test/text.tm
@@ -35,7 +35,7 @@ func main():
>> Text.from_bytes([:Byte 0x41, 0x6D, 0xC3, 0xA9, 0x6C, 0x69, 0x65])!
= "Amélie"
>> Text.from_bytes([Byte(0xFF)])
- = NONE : Text?
+ = none : Text?
>> amelie2 := "Am$(\U65\U301)lie"
>> amelie2:split()
@@ -189,9 +189,9 @@ func main():
!! Test text:find()
>> " one two three ":find($/{id}/, start=-999)
- = NONE : Match?
+ = none : Match?
>> " one two three ":find($/{id}/, start=999)
- = NONE : Match?
+ = none : Match?
>> " one two three ":find($/{id}/)
= Match(text="one", index=2, captures=["one"]) : Match?
>> " one two three ":find($/{id}/, start=5)
@@ -222,7 +222,7 @@ func main():
= ["PENGUIN"]
>> Text.from_codepoint_names(["not a valid name here buddy"])
- = NONE : Text?
+ = none : Text?
>> "one two; three four":find_all($/; {..}/)
= [Match(text="; three four", index=8, captures=["three four"])]
@@ -249,11 +249,11 @@ func main():
>> "Hello":matches($/{id}/)
= ["Hello"] : [Text]?
>> "Hello":matches($/{lower}/)
- = NONE : [Text]?
+ = none : [Text]?
>> "Hello":matches($/{upper}/)
- = NONE : [Text]?
+ = none : [Text]?
>> "Hello...":matches($/{id}/)
- = NONE : [Text]?
+ = none : [Text]?
if matches := "hello world":matches($/{id} {id}/):
>> matches