diff options
| author | Andrew Kelley <superjoe30@gmail.com> | 2018-05-28 20:23:55 -0400 |
|---|---|---|
| committer | Andrew Kelley <superjoe30@gmail.com> | 2018-05-29 04:23:38 -0400 |
| commit | 0c16cd2d0ed78be2d160f9c865cd0a8703348232 (patch) | |
| tree | e7ff390d89611797776f2e67151c1157059d6147 /test/cases/error.zig | |
| parent | cdf30c31ea36365859dd81c207aede3c45c4e022 (diff) | |
| download | zig-0c16cd2d0ed78be2d160f9c865cd0a8703348232.tar.gz zig-0c16cd2d0ed78be2d160f9c865cd0a8703348232.zip | |
run zig fmt on the codebase
See #1003
Diffstat (limited to 'test/cases/error.zig')
| -rw-r--r-- | test/cases/error.zig | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/test/cases/error.zig b/test/cases/error.zig index 70d96e4d01..92b2a012bd 100644 --- a/test/cases/error.zig +++ b/test/cases/error.zig @@ -92,7 +92,7 @@ test "error set type " { comptime testErrorSetType(); } -const MyErrSet = error { +const MyErrSet = error{ OutOfMemory, FileNotFound, }; @@ -114,11 +114,11 @@ test "explicit error set cast" { comptime testExplicitErrorSetCast(Set1.A); } -const Set1 = error { +const Set1 = error{ A, B, }; -const Set2 = error { +const Set2 = error{ A, C, }; @@ -134,8 +134,7 @@ test "comptime test error for empty error set" { comptime testComptimeTestErrorEmptySet(1234); } -const EmptyErrorSet = error { -}; +const EmptyErrorSet = error{}; fn testComptimeTestErrorEmptySet(x: EmptyErrorSet!i32) void { if (x) |v| assert(v == 1234) else |err| @compileError("bad"); @@ -151,9 +150,10 @@ test "comptime err to int of error set with only 1 possible value" { testErrToIntWithOnePossibleValue(error.A, u32(error.A)); comptime testErrToIntWithOnePossibleValue(error.A, u32(error.A)); } -fn testErrToIntWithOnePossibleValue(x: error { - A, -}, comptime value: u32) void { +fn testErrToIntWithOnePossibleValue( + x: error{A}, + comptime value: u32, +) void { if (u32(x) != value) { @compileError("bad"); } @@ -197,16 +197,14 @@ fn foo2(f: fn() error!void) void { const x = f(); } -fn bar2() (error { -}!void) {} +fn bar2() (error{}!void) {} test "error: Zero sized error set returned with value payload crash" { _ = foo3(0); _ = comptime foo3(0); } -const Error = error { -}; +const Error = error{}; fn foo3(b: usize) Error!usize { return b; } |
