optionals
This commit is contained in:
1
tests/expected/32-optionals.exit
Normal file
1
tests/expected/32-optionals.exit
Normal file
@@ -0,0 +1 @@
|
||||
0
|
||||
20
tests/expected/32-optionals.txt
Normal file
20
tests/expected/32-optionals.txt
Normal file
@@ -0,0 +1,20 @@
|
||||
x = 42
|
||||
y = null
|
||||
x! = 42
|
||||
x ?? 0 = 42
|
||||
y ?? 99 = 99
|
||||
if-bind x: 42
|
||||
if-bind y: none
|
||||
match some: 42
|
||||
match none: 0
|
||||
p?.value = 10
|
||||
q?.value = 0
|
||||
o1.inner?.val = 99
|
||||
o2.inner?.val = 0
|
||||
narrowed a: 10
|
||||
guard 42: 42
|
||||
guard null: 0
|
||||
both: 10 20
|
||||
guard2: 7
|
||||
default next: null
|
||||
comptime: 141
|
||||
@@ -249,6 +249,9 @@ cast-int-f64: 42.000000
|
||||
run-const: 25
|
||||
run-expr: 42
|
||||
run-chain: 30
|
||||
ct-opt-coalesce: 141
|
||||
ct-opt-unwrap: 77
|
||||
ct-opt-guard: 10
|
||||
insert-ok
|
||||
insert-gen: 42
|
||||
=== 9. Flags ===
|
||||
@@ -386,4 +389,41 @@ buf reset: 0
|
||||
1 == (1)
|
||||
(1) == 1
|
||||
1 == 1
|
||||
--- optionals ---
|
||||
opt x: 42
|
||||
opt y: null
|
||||
unwrap: 10
|
||||
coalesce a: 42
|
||||
coalesce b: 99
|
||||
if-bind x: 7
|
||||
if-bind y: none
|
||||
match some: 55
|
||||
match none: 0
|
||||
wrap pos: 5
|
||||
wrap neg: null
|
||||
opt field default: null
|
||||
opt field set: 42
|
||||
opt param a: 42
|
||||
opt param b: 0
|
||||
opt param 7: 7
|
||||
generic opt 1: 5
|
||||
generic opt 2: 7
|
||||
generic opt 3: null
|
||||
chain some: 10
|
||||
chain none: 0
|
||||
chain print: 20
|
||||
chain null: null
|
||||
deep chain 1: 99
|
||||
deep chain 2: 0
|
||||
narrow x: 42
|
||||
narrow y else: null
|
||||
narrow else x: 42
|
||||
guard some: 42
|
||||
guard none: 0
|
||||
and both: 10 20
|
||||
and one null
|
||||
or guard: 7
|
||||
or guard null: 0
|
||||
nested narrow: 10 20
|
||||
guard loop: 3
|
||||
=== DONE ===
|
||||
|
||||
Reference in New Issue
Block a user