diff options
| author | Jakub Konka <kubkon@jakubkonka.com> | 2022-04-29 08:24:02 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-04-29 08:24:02 +0200 |
| commit | 3b8187072fc76966da9d9ab1a6a0ecd7aff4e090 (patch) | |
| tree | a998ecb0837408b309851b558b7eb5f2d5d42dbe /test/incremental/arm-linux/errors.2.zig | |
| parent | fda143d5d81da852af73386a2100e18784bd0d3c (diff) | |
| parent | d25f06a71c058aa4ff8bf40749345028bda6e017 (diff) | |
| download | zig-3b8187072fc76966da9d9ab1a6a0ecd7aff4e090.tar.gz zig-3b8187072fc76966da9d9ab1a6a0ecd7aff4e090.zip | |
Merge pull request #11530 from ziglang/test-harness
test: move compare and run tests to new test harness
Diffstat (limited to 'test/incremental/arm-linux/errors.2.zig')
| -rw-r--r-- | test/incremental/arm-linux/errors.2.zig | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/incremental/arm-linux/errors.2.zig b/test/incremental/arm-linux/errors.2.zig new file mode 100644 index 0000000000..a1b9aef97d --- /dev/null +++ b/test/incremental/arm-linux/errors.2.zig @@ -0,0 +1,27 @@ +pub fn main() void { + foo() catch |err| { + assert(err == error.Foo); + assert(err != error.Bar); + assert(err != error.Baz); + }; + bar() catch |err| { + assert(err != error.Foo); + assert(err == error.Bar); + assert(err != error.Baz); + }; +} + +fn assert(ok: bool) void { + if (!ok) unreachable; +} + +fn foo() anyerror!void { + return error.Foo; +} + +fn bar() anyerror!void { + return error.Bar; +} + +// run +// |
