diff options
Diffstat (limited to 'test')
| -rw-r--r-- | test/optionals.tm | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/optionals.tm b/test/optionals.tm index 521bba51..5d54b29e 100644 --- a/test/optionals.tm +++ b/test/optionals.tm @@ -55,6 +55,12 @@ func maybe_c_string(should_i:Bool)->CString?: else: return !CString +func maybe_channel(should_i:Bool)->|Int|?: + if should_i: + return |:Int|? + else: + return !|Int| + func main(): >> 5? = 5? : Int? @@ -181,6 +187,19 @@ func main(): fail("Truthy: $nope") else: !! Falsey: $nope + do: + !! ... + !! Channels: + >> yep := maybe_channel(yes) + # No "=" test here because channels use addresses in the text version + >> nope := maybe_channel(no) + = !|:Int| + >> if yep: >> yep + else: fail("Falsey: $yep") + >> if nope: + fail("Truthy: $nope") + else: !! Falsey: $nope + if yep := maybe_int(yes): >> yep = 123 : Int |
