Skip to content

Commit a64d9fa

Browse files
committed
Add test for unwrapping none
1 parent 03c866e commit a64d9fa

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

formats/unwrap-none.fathom

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
def main = {
2+
let ary : Array16 3 U16 = [1, 2, 3],
3+
x <- unwrap U16 (array16_find _ U16 (fun el => el == (4 : U16)) ary),
4+
};

formats/unwrap-none.snap

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
stdout = '''
2+
def main : Format = {
3+
let ary : Array16 3 U16 = [ 1, 2, 3 ],
4+
x <- unwrap U16 (array16_find (_ ary) U16 (fun el => el == (4 : U16)) ary),
5+
};
6+
'''
7+
stderr = ''

tests/cmd/fathom-data.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,3 +291,18 @@ error: mismatched types
291291

292292

293293
```
294+
295+
### Unwrap none
296+
297+
Unwrapping a none value will result in an error
298+
299+
```console
300+
$ fathom data --module formats/unwrap-none.fathom
301+
> formats/data/opentype/aots/cmap0_font1.otf
302+
? failed
303+
error: unwrapped none
304+
= option_unwrap was called on a none value.
305+
306+
307+
```
308+

0 commit comments

Comments
 (0)