Add a crash test to mono

This commit is contained in:
Ayaz Hafiz 2022-11-22 15:50:50 -06:00
parent c7ef1668d4
commit 220c8a8e64
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
2 changed files with 24 additions and 1 deletions

View file

@ -0,0 +1,18 @@
procedure Test.1 (Test.2):
let Test.10 : U8 = 1i64;
let Test.11 : U8 = GetTagId Test.2;
let Test.12 : Int1 = lowlevel Eq Test.10 Test.11;
if Test.12 then
let Test.3 : U64 = UnionAtIndex (Id 1) (Index 0) Test.2;
dec Test.2;
ret Test.3;
else
dec Test.2;
let Test.9 : Str = "turns out this was fallible";
Crash `#UserApp.9`
procedure Test.0 ():
let Test.13 : U64 = 78i64;
let Test.4 : [C Str, C U64] = TagId(1) Test.13;
let Test.6 : U64 = CallByName Test.1 Test.4;
ret Test.6;

View file

@ -2035,11 +2035,16 @@ fn recursive_function_and_union_with_inference_hole() {
fn crash() {
indoc!(
r#"
app "test" provides [getInfallible] to "./platform"
app "test" provides [main] to "./platform"
getInfallible = \result -> when result is
Ok x -> x
_ -> crash "turns out this was fallible"
main =
x : [Ok U64, Err Str]
x = Ok 78
getInfallible x
"#
)
}