mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
21 lines
313 B
C
21 lines
313 B
C
module catch_err @test;
|
|
|
|
fn void test()
|
|
{
|
|
anyfault a;
|
|
int! z = {|
|
|
const ABC = 4;
|
|
int! x = SearchResult.MISSING?;
|
|
defer (catch err) a = err;
|
|
return x;
|
|
|};
|
|
assert(a == SearchResult.MISSING);
|
|
anyfault y;
|
|
z = {|
|
|
const ABC = 4;
|
|
int! x = 1;
|
|
defer (catch err) y = err;
|
|
return x;
|
|
|};
|
|
assert(!y);
|
|
} |