| ... | @@ -6,15 +6,7 @@ const std = @import("std.zig"); | ... | @@ -6,15 +6,7 @@ const std = @import("std.zig"); |
| 6 | /// and then aborts when actual_error_union is not expected_error. | 6 | /// and then aborts when actual_error_union is not expected_error. |
| 7 | pub fn expectError(expected_error: anyerror, actual_error_union: var) void { | 7 | pub fn expectError(expected_error: anyerror, actual_error_union: var) void { |
| 8 | if (actual_error_union) |actual_payload| { | 8 | if (actual_error_union) |actual_payload| { |
| 9 | // TODO remove workaround here for https://github.com/ziglang/zig/issues/557 | 9 | std.debug.panic("expected error.{}, found {}", .{ @errorName(expected_error), actual_payload }); |
| 10 | if (@sizeOf(@typeOf(actual_payload)) == 0) { | | |
| 11 | std.debug.panic("expected error.{}, found {} value", .{ | | |
| 12 | @errorName(expected_error), | | |
| 13 | @typeName(@typeOf(actual_payload)), | | |
| 14 | }); | | |
| 15 | } else { | | |
| 16 | std.debug.panic("expected error.{}, found {}", .{ @errorName(expected_error), actual_payload }); | | |
| 17 | } | | |
| 18 | } else |actual_error| { | 10 | } else |actual_error| { |
| 19 | if (expected_error != actual_error) { | 11 | if (expected_error != actual_error) { |
| 20 | std.debug.panic("expected error.{}, found error.{}", .{ | 12 | std.debug.panic("expected error.{}, found error.{}", .{ |