| ... | ... | @@ -41,7 +41,7 @@ pub const backend_can_print = switch (builtin.zig_backend) { |
| 41 | 41 | else => true, |
| 42 | 42 | }; |
| 43 | 43 | |
| 44 | | fn print(comptime fmt: []const u8, args: anytype) void { |
| 44 | fn failPrint(comptime fmt: []const u8, args: anytype) void { |
| 45 | 45 | if (@inComptime()) { |
| 46 | 46 | @compileError(std.fmt.comptimePrint(fmt, args)); |
| 47 | 47 | } else if (backend_can_print) { |
| ... | ... | @@ -53,11 +53,11 @@ fn print(comptime fmt: []const u8, args: anytype) void { |
| 53 | 53 | /// and then returns a test failure error when actual_error_union is not expected_error. |
| 54 | 54 | pub fn expectError(expected_error: anyerror, actual_error_union: anytype) !void { |
| 55 | 55 | if (actual_error_union) |actual_payload| { |
| 56 | | print("expected error.{s}, found {any}\n", .{ @errorName(expected_error), actual_payload }); |
| 56 | failPrint("expected error.{s}, found {any}\n", .{ @errorName(expected_error), actual_payload }); |
| 57 | 57 | return error.TestExpectedError; |
| 58 | 58 | } else |actual_error| { |
| 59 | 59 | if (expected_error != actual_error) { |
| 60 | | print("expected error.{s}, found error.{s}\n", .{ |
| 60 | failPrint("expected error.{s}, found error.{s}\n", .{ |
| 61 | 61 | @errorName(expected_error), |
| 62 | 62 | @errorName(actual_error), |
| 63 | 63 | }); |
| ... | ... | @@ -91,7 +91,7 @@ fn expectEqualInner(comptime T: type, expected: T, actual: T) !void { |
| 91 | 91 | |
| 92 | 92 | .type => { |
| 93 | 93 | if (actual != expected) { |
| 94 | | print("expected type {s}, found type {s}\n", .{ @typeName(expected), @typeName(actual) }); |
| 94 | failPrint("expected type {s}, found type {s}\n", .{ @typeName(expected), @typeName(actual) }); |
| 95 | 95 | return error.TestExpectedEqual; |
| 96 | 96 | } |
| 97 | 97 | }, |
| ... | ... | @@ -107,7 +107,7 @@ fn expectEqualInner(comptime T: type, expected: T, actual: T) !void { |
| 107 | 107 | .error_set, |
| 108 | 108 | => { |
| 109 | 109 | if (actual != expected) { |
| 110 | | print("expected {any}, found {any}\n", .{ expected, actual }); |
| 110 | failPrint("expected {any}, found {any}\n", .{ expected, actual }); |
| 111 | 111 | return error.TestExpectedEqual; |
| 112 | 112 | } |
| 113 | 113 | }, |
| ... | ... | @@ -116,17 +116,17 @@ fn expectEqualInner(comptime T: type, expected: T, actual: T) !void { |
| 116 | 116 | switch (pointer.size) { |
| 117 | 117 | .one, .many, .c => { |
| 118 | 118 | if (actual != expected) { |
| 119 | | print("expected {*}, found {*}\n", .{ expected, actual }); |
| 119 | failPrint("expected {*}, found {*}\n", .{ expected, actual }); |
| 120 | 120 | return error.TestExpectedEqual; |
| 121 | 121 | } |
| 122 | 122 | }, |
| 123 | 123 | .slice => { |
| 124 | 124 | if (actual.ptr != expected.ptr) { |
| 125 | | print("expected slice ptr {*}, found {*}\n", .{ expected.ptr, actual.ptr }); |
| 125 | failPrint("expected slice ptr {*}, found {*}\n", .{ expected.ptr, actual.ptr }); |
| 126 | 126 | return error.TestExpectedEqual; |
| 127 | 127 | } |
| 128 | 128 | if (actual.len != expected.len) { |
| 129 | | print("expected slice len {}, found {}\n", .{ expected.len, actual.len }); |
| 129 | failPrint("expected slice len {}, found {}\n", .{ expected.len, actual.len }); |
| 130 | 130 | return error.TestExpectedEqual; |
| 131 | 131 | } |
| 132 | 132 | }, |
| ... | ... | @@ -187,12 +187,12 @@ fn expectEqualInner(comptime T: type, expected: T, actual: T) !void { |
| 187 | 187 | if (actual) |actual_payload| { |
| 188 | 188 | try expectEqual(expected_payload, actual_payload); |
| 189 | 189 | } else { |
| 190 | | print("expected {any}, found null\n", .{expected_payload}); |
| 190 | failPrint("expected {any}, found null\n", .{expected_payload}); |
| 191 | 191 | return error.TestExpectedEqual; |
| 192 | 192 | } |
| 193 | 193 | } else { |
| 194 | 194 | if (actual) |actual_payload| { |
| 195 | | print("expected null, found {any}\n", .{actual_payload}); |
| 195 | failPrint("expected null, found {any}\n", .{actual_payload}); |
| 196 | 196 | return error.TestExpectedEqual; |
| 197 | 197 | } |
| 198 | 198 | } |
| ... | ... | @@ -203,12 +203,12 @@ fn expectEqualInner(comptime T: type, expected: T, actual: T) !void { |
| 203 | 203 | if (actual) |actual_payload| { |
| 204 | 204 | try expectEqual(expected_payload, actual_payload); |
| 205 | 205 | } else |actual_err| { |
| 206 | | print("expected {any}, found {}\n", .{ expected_payload, actual_err }); |
| 206 | failPrint("expected {any}, found {}\n", .{ expected_payload, actual_err }); |
| 207 | 207 | return error.TestExpectedEqual; |
| 208 | 208 | } |
| 209 | 209 | } else |expected_err| { |
| 210 | 210 | if (actual) |actual_payload| { |
| 211 | | print("expected {}, found {any}\n", .{ expected_err, actual_payload }); |
| 211 | failPrint("expected {}, found {any}\n", .{ expected_err, actual_payload }); |
| 212 | 212 | return error.TestExpectedEqual; |
| 213 | 213 | } else |actual_err| { |
| 214 | 214 | try expectEqual(expected_err, actual_err); |
| ... | ... | @@ -295,7 +295,7 @@ pub inline fn expectApproxEqAbs(expected: anytype, actual: anytype, tolerance: a |
| 295 | 295 | fn expectApproxEqAbsInner(comptime T: type, expected: T, actual: T, tolerance: T) !void { |
| 296 | 296 | switch (@typeInfo(T)) { |
| 297 | 297 | .float => if (!math.approxEqAbs(T, expected, actual, tolerance)) { |
| 298 | | print("actual {}, not within absolute tolerance {} of expected {}\n", .{ actual, tolerance, expected }); |
| 298 | failPrint("actual {}, not within absolute tolerance {} of expected {}\n", .{ actual, tolerance, expected }); |
| 299 | 299 | return error.TestExpectedApproxEqAbs; |
| 300 | 300 | }, |
| 301 | 301 | |
| ... | ... | @@ -331,7 +331,7 @@ pub inline fn expectApproxEqRel(expected: anytype, actual: anytype, tolerance: a |
| 331 | 331 | fn expectApproxEqRelInner(comptime T: type, expected: T, actual: T, tolerance: T) !void { |
| 332 | 332 | switch (@typeInfo(T)) { |
| 333 | 333 | .float => if (!math.approxEqRel(T, expected, actual, tolerance)) { |
| 334 | | print("actual {}, not within relative tolerance {} of expected {}\n", .{ actual, tolerance, expected }); |
| 334 | failPrint("actual {}, not within relative tolerance {} of expected {}\n", .{ actual, tolerance, expected }); |
| 335 | 335 | return error.TestExpectedApproxEqRel; |
| 336 | 336 | }, |
| 337 | 337 | |
| ... | ... | @@ -598,12 +598,12 @@ pub fn expectEqualSentinel(comptime T: type, comptime sentinel: T, expected: [:s |
| 598 | 598 | }; |
| 599 | 599 | |
| 600 | 600 | if (!std.meta.eql(sentinel, expected_value_sentinel)) { |
| 601 | | print("expectEqualSentinel: 'expected' sentinel in memory is different from its type sentinel. type sentinel {}, in memory sentinel {}\n", .{ sentinel, expected_value_sentinel }); |
| 601 | failPrint("expectEqualSentinel: 'expected' sentinel in memory is different from its type sentinel. type sentinel {}, in memory sentinel {}\n", .{ sentinel, expected_value_sentinel }); |
| 602 | 602 | return error.TestExpectedEqual; |
| 603 | 603 | } |
| 604 | 604 | |
| 605 | 605 | if (!std.meta.eql(sentinel, actual_value_sentinel)) { |
| 606 | | print("expectEqualSentinel: 'actual' sentinel in memory is different from its type sentinel. type sentinel {}, in memory sentinel {}\n", .{ sentinel, actual_value_sentinel }); |
| 606 | failPrint("expectEqualSentinel: 'actual' sentinel in memory is different from its type sentinel. type sentinel {}, in memory sentinel {}\n", .{ sentinel, actual_value_sentinel }); |
| 607 | 607 | return error.TestExpectedEqual; |
| 608 | 608 | } |
| 609 | 609 | } |
| ... | ... | @@ -660,23 +660,23 @@ pub fn expectEqualStrings(expected: []const u8, actual: []const u8) !void { |
| 660 | 660 | expected, actual, diff_index, |
| 661 | 661 | })); |
| 662 | 662 | } |
| 663 | | print("\n====== expected this output: =========\n", .{}); |
| 664 | | printWithVisibleNewlines(expected); |
| 665 | | print("\n======== instead found this: =========\n", .{}); |
| 666 | | printWithVisibleNewlines(actual); |
| 667 | | print("\n======================================\n", .{}); |
| 663 | failPrint("\n====== expected this output: =========\n", .{}); |
| 664 | failPrintWithVisibleNewlines(expected); |
| 665 | failPrint("\n======== instead found this: =========\n", .{}); |
| 666 | failPrintWithVisibleNewlines(actual); |
| 667 | failPrint("\n======================================\n", .{}); |
| 668 | 668 | |
| 669 | 669 | var diff_line_number: usize = 1; |
| 670 | 670 | for (expected[0..diff_index]) |value| { |
| 671 | 671 | if (value == '\n') diff_line_number += 1; |
| 672 | 672 | } |
| 673 | | print("First difference occurs on line {d}:\n", .{diff_line_number}); |
| 673 | failPrint("First difference occurs on line {d}:\n", .{diff_line_number}); |
| 674 | 674 | |
| 675 | | print("expected:\n", .{}); |
| 676 | | printIndicatorLine(expected, diff_index); |
| 675 | failPrint("expected:\n", .{}); |
| 676 | failPrintIndicatorLine(expected, diff_index); |
| 677 | 677 | |
| 678 | | print("found:\n", .{}); |
| 679 | | printIndicatorLine(actual, diff_index); |
| 678 | failPrint("found:\n", .{}); |
| 679 | failPrintIndicatorLine(actual, diff_index); |
| 680 | 680 | |
| 681 | 681 | return error.TestExpectedEqual; |
| 682 | 682 | } |
| ... | ... | @@ -691,13 +691,13 @@ pub fn expectStringStartsWith(actual: []const u8, expected_starts_with: []const |
| 691 | 691 | else |
| 692 | 692 | actual; |
| 693 | 693 | |
| 694 | | print("\n====== expected to start with: =========\n", .{}); |
| 695 | | printWithVisibleNewlines(expected_starts_with); |
| 696 | | print("\n====== instead started with: ===========\n", .{}); |
| 697 | | printWithVisibleNewlines(shortened_actual); |
| 698 | | print("\n========= full output: ==============\n", .{}); |
| 699 | | printWithVisibleNewlines(actual); |
| 700 | | print("\n======================================\n", .{}); |
| 694 | failPrint("\n====== expected to start with: =========\n", .{}); |
| 695 | failPrintWithVisibleNewlines(expected_starts_with); |
| 696 | failPrint("\n====== instead started with: ===========\n", .{}); |
| 697 | failPrintWithVisibleNewlines(shortened_actual); |
| 698 | failPrint("\n========= full output: ==============\n", .{}); |
| 699 | failPrintWithVisibleNewlines(actual); |
| 700 | failPrint("\n======================================\n", .{}); |
| 701 | 701 | |
| 702 | 702 | return error.TestExpectedStartsWith; |
| 703 | 703 | } |
| ... | ... | @@ -711,13 +711,13 @@ pub fn expectStringEndsWith(actual: []const u8, expected_ends_with: []const u8) |
| 711 | 711 | else |
| 712 | 712 | actual; |
| 713 | 713 | |
| 714 | | print("\n====== expected to end with: =========\n", .{}); |
| 715 | | printWithVisibleNewlines(expected_ends_with); |
| 716 | | print("\n====== instead ended with: ===========\n", .{}); |
| 717 | | printWithVisibleNewlines(shortened_actual); |
| 718 | | print("\n========= full output: ==============\n", .{}); |
| 719 | | printWithVisibleNewlines(actual); |
| 720 | | print("\n======================================\n", .{}); |
| 714 | failPrint("\n====== expected to end with: =========\n", .{}); |
| 715 | failPrintWithVisibleNewlines(expected_ends_with); |
| 716 | failPrint("\n====== instead ended with: ===========\n", .{}); |
| 717 | failPrintWithVisibleNewlines(shortened_actual); |
| 718 | failPrint("\n========= full output: ==============\n", .{}); |
| 719 | failPrintWithVisibleNewlines(actual); |
| 720 | failPrint("\n======================================\n", .{}); |
| 721 | 721 | |
| 722 | 722 | return error.TestExpectedEndsWith; |
| 723 | 723 | } |
| ... | ... | @@ -756,7 +756,7 @@ fn expectEqualDeepInner(comptime T: type, expected: T, actual: T) error{TestExpe |
| 756 | 756 | |
| 757 | 757 | .type => { |
| 758 | 758 | if (actual != expected) { |
| 759 | | print("expected type {s}, found type {s}\n", .{ @typeName(expected), @typeName(actual) }); |
| 759 | failPrint("expected type {s}, found type {s}\n", .{ @typeName(expected), @typeName(actual) }); |
| 760 | 760 | return error.TestExpectedEqual; |
| 761 | 761 | } |
| 762 | 762 | }, |
| ... | ... | @@ -772,7 +772,7 @@ fn expectEqualDeepInner(comptime T: type, expected: T, actual: T) error{TestExpe |
| 772 | 772 | .error_set, |
| 773 | 773 | => { |
| 774 | 774 | if (actual != expected) { |
| 775 | | print("expected {any}, found {any}\n", .{ expected, actual }); |
| 775 | failPrint("expected {any}, found {any}\n", .{ expected, actual }); |
| 776 | 776 | return error.TestExpectedEqual; |
| 777 | 777 | } |
| 778 | 778 | }, |
| ... | ... | @@ -782,7 +782,7 @@ fn expectEqualDeepInner(comptime T: type, expected: T, actual: T) error{TestExpe |
| 782 | 782 | // We have no idea what is behind those pointers, so the best we can do is `==` check. |
| 783 | 783 | .c, .many => { |
| 784 | 784 | if (actual != expected) { |
| 785 | | print("expected {*}, found {*}\n", .{ expected, actual }); |
| 785 | failPrint("expected {*}, found {*}\n", .{ expected, actual }); |
| 786 | 786 | return error.TestExpectedEqual; |
| 787 | 787 | } |
| 788 | 788 | }, |
| ... | ... | @@ -791,7 +791,7 @@ fn expectEqualDeepInner(comptime T: type, expected: T, actual: T) error{TestExpe |
| 791 | 791 | switch (@typeInfo(pointer.child)) { |
| 792 | 792 | .@"fn", .@"opaque" => { |
| 793 | 793 | if (actual != expected) { |
| 794 | | print("expected {*}, found {*}\n", .{ expected, actual }); |
| 794 | failPrint("expected {*}, found {*}\n", .{ expected, actual }); |
| 795 | 795 | return error.TestExpectedEqual; |
| 796 | 796 | } |
| 797 | 797 | }, |
| ... | ... | @@ -800,13 +800,13 @@ fn expectEqualDeepInner(comptime T: type, expected: T, actual: T) error{TestExpe |
| 800 | 800 | }, |
| 801 | 801 | .slice => { |
| 802 | 802 | if (expected.len != actual.len) { |
| 803 | | print("Slice len not the same, expected {d}, found {d}\n", .{ expected.len, actual.len }); |
| 803 | failPrint("Slice len not the same, expected {d}, found {d}\n", .{ expected.len, actual.len }); |
| 804 | 804 | return error.TestExpectedEqual; |
| 805 | 805 | } |
| 806 | 806 | var i: usize = 0; |
| 807 | 807 | while (i < expected.len) : (i += 1) { |
| 808 | 808 | expectEqualDeep(expected[i], actual[i]) catch |e| { |
| 809 | | print("index {d} incorrect. expected {any}, found {any}\n", .{ |
| 809 | failPrint("index {d} incorrect. expected {any}, found {any}\n", .{ |
| 810 | 810 | i, expected[i], actual[i], |
| 811 | 811 | }); |
| 812 | 812 | return e; |
| ... | ... | @@ -818,13 +818,13 @@ fn expectEqualDeepInner(comptime T: type, expected: T, actual: T) error{TestExpe |
| 818 | 818 | |
| 819 | 819 | .array => { |
| 820 | 820 | if (expected.len != actual.len) { |
| 821 | | print("Array len not the same, expected {d}, found {d}\n", .{ expected.len, actual.len }); |
| 821 | failPrint("Array len not the same, expected {d}, found {d}\n", .{ expected.len, actual.len }); |
| 822 | 822 | return error.TestExpectedEqual; |
| 823 | 823 | } |
| 824 | 824 | var i: usize = 0; |
| 825 | 825 | while (i < expected.len) : (i += 1) { |
| 826 | 826 | expectEqualDeep(expected[i], actual[i]) catch |e| { |
| 827 | | print("index {d} incorrect. expected {any}, found {any}\n", .{ |
| 827 | failPrint("index {d} incorrect. expected {any}, found {any}\n", .{ |
| 828 | 828 | i, expected[i], actual[i], |
| 829 | 829 | }); |
| 830 | 830 | return e; |
| ... | ... | @@ -834,12 +834,12 @@ fn expectEqualDeepInner(comptime T: type, expected: T, actual: T) error{TestExpe |
| 834 | 834 | |
| 835 | 835 | .vector => |info| { |
| 836 | 836 | if (info.len != @typeInfo(@TypeOf(actual)).vector.len) { |
| 837 | | print("Vector len not the same, expected {d}, found {d}\n", .{ info.len, @typeInfo(@TypeOf(actual)).vector.len }); |
| 837 | failPrint("Vector len not the same, expected {d}, found {d}\n", .{ info.len, @typeInfo(@TypeOf(actual)).vector.len }); |
| 838 | 838 | return error.TestExpectedEqual; |
| 839 | 839 | } |
| 840 | 840 | inline for (0..info.len) |i| { |
| 841 | 841 | expectEqualDeep(expected[i], actual[i]) catch |e| { |
| 842 | | print("index {d} incorrect. expected {any}, found {any}\n", .{ |
| 842 | failPrint("index {d} incorrect. expected {any}, found {any}\n", .{ |
| 843 | 843 | i, expected[i], actual[i], |
| 844 | 844 | }); |
| 845 | 845 | return e; |
| ... | ... | @@ -850,7 +850,7 @@ fn expectEqualDeepInner(comptime T: type, expected: T, actual: T) error{TestExpe |
| 850 | 850 | .@"struct" => |structType| { |
| 851 | 851 | inline for (structType.field_names) |field_name| { |
| 852 | 852 | expectEqualDeep(@field(expected, field_name), @field(actual, field_name)) catch |e| { |
| 853 | | print("Field {s} incorrect. expected {any}, found {any}\n", .{ field_name, @field(expected, field_name), @field(actual, field_name) }); |
| 853 | failPrint("Field {s} incorrect. expected {any}, found {any}\n", .{ field_name, @field(expected, field_name), @field(actual, field_name) }); |
| 854 | 854 | return e; |
| 855 | 855 | }; |
| 856 | 856 | } |
| ... | ... | @@ -881,12 +881,12 @@ fn expectEqualDeepInner(comptime T: type, expected: T, actual: T) error{TestExpe |
| 881 | 881 | if (actual) |actual_payload| { |
| 882 | 882 | try expectEqualDeep(expected_payload, actual_payload); |
| 883 | 883 | } else { |
| 884 | | print("expected {any}, found null\n", .{expected_payload}); |
| 884 | failPrint("expected {any}, found null\n", .{expected_payload}); |
| 885 | 885 | return error.TestExpectedEqual; |
| 886 | 886 | } |
| 887 | 887 | } else { |
| 888 | 888 | if (actual) |actual_payload| { |
| 889 | | print("expected null, found {any}\n", .{actual_payload}); |
| 889 | failPrint("expected null, found {any}\n", .{actual_payload}); |
| 890 | 890 | return error.TestExpectedEqual; |
| 891 | 891 | } |
| 892 | 892 | } |
| ... | ... | @@ -897,12 +897,12 @@ fn expectEqualDeepInner(comptime T: type, expected: T, actual: T) error{TestExpe |
| 897 | 897 | if (actual) |actual_payload| { |
| 898 | 898 | try expectEqualDeep(expected_payload, actual_payload); |
| 899 | 899 | } else |actual_err| { |
| 900 | | print("expected {any}, found {any}\n", .{ expected_payload, actual_err }); |
| 900 | failPrint("expected {any}, found {any}\n", .{ expected_payload, actual_err }); |
| 901 | 901 | return error.TestExpectedEqual; |
| 902 | 902 | } |
| 903 | 903 | } else |expected_err| { |
| 904 | 904 | if (actual) |actual_payload| { |
| 905 | | print("expected {any}, found {any}\n", .{ expected_err, actual_payload }); |
| 905 | failPrint("expected {any}, found {any}\n", .{ expected_err, actual_payload }); |
| 906 | 906 | return error.TestExpectedEqual; |
| 907 | 907 | } else |actual_err| { |
| 908 | 908 | try expectEqualDeep(expected_err, actual_err); |
| ... | ... | @@ -998,7 +998,7 @@ test "expectEqualDeep composite type" { |
| 998 | 998 | ); |
| 999 | 999 | } |
| 1000 | 1000 | |
| 1001 | | fn printIndicatorLine(source: []const u8, indicator_index: usize) void { |
| 1001 | fn failPrintIndicatorLine(source: []const u8, indicator_index: usize) void { |
| 1002 | 1002 | const line_begin_index = if (std.mem.findScalarLast(u8, source[0..indicator_index], '\n')) |line_begin| |
| 1003 | 1003 | line_begin + 1 |
| 1004 | 1004 | else |
| ... | ... | @@ -1008,29 +1008,29 @@ fn printIndicatorLine(source: []const u8, indicator_index: usize) void { |
| 1008 | 1008 | else |
| 1009 | 1009 | source.len; |
| 1010 | 1010 | |
| 1011 | | printLine(source[line_begin_index..line_end_index]); |
| 1011 | failPrintLine(source[line_begin_index..line_end_index]); |
| 1012 | 1012 | for (line_begin_index..indicator_index) |_| |
| 1013 | | print(" ", .{}); |
| 1013 | failPrint(" ", .{}); |
| 1014 | 1014 | if (indicator_index >= source.len) |
| 1015 | | print("^ (end of string)\n", .{}) |
| 1015 | failPrint("^ (end of string)\n", .{}) |
| 1016 | 1016 | else |
| 1017 | | print("^ ('\\x{x:0>2}')\n", .{source[indicator_index]}); |
| 1017 | failPrint("^ ('\\x{x:0>2}')\n", .{source[indicator_index]}); |
| 1018 | 1018 | } |
| 1019 | 1019 | |
| 1020 | | fn printWithVisibleNewlines(source: []const u8) void { |
| 1020 | fn failPrintWithVisibleNewlines(source: []const u8) void { |
| 1021 | 1021 | var i: usize = 0; |
| 1022 | 1022 | while (std.mem.findScalar(u8, source[i..], '\n')) |nl| : (i += nl + 1) { |
| 1023 | | printLine(source[i..][0..nl]); |
| 1023 | failPrintLine(source[i..][0..nl]); |
| 1024 | 1024 | } |
| 1025 | | print("{s}␃\n", .{source[i..]}); // End of Text symbol (ETX) |
| 1025 | failPrint("{s}␃\n", .{source[i..]}); // End of Text symbol (ETX) |
| 1026 | 1026 | } |
| 1027 | 1027 | |
| 1028 | | fn printLine(line: []const u8) void { |
| 1028 | fn failPrintLine(line: []const u8) void { |
| 1029 | 1029 | if (line.len != 0) switch (line[line.len - 1]) { |
| 1030 | | ' ', '\t' => return print("{s}⏎\n", .{line}), // Return symbol |
| 1030 | ' ', '\t' => return failPrint("{s}⏎\n", .{line}), // Return symbol |
| 1031 | 1031 | else => {}, |
| 1032 | 1032 | }; |
| 1033 | | print("{s}\n", .{line}); |
| 1033 | failPrint("{s}\n", .{line}); |
| 1034 | 1034 | } |
| 1035 | 1035 | |
| 1036 | 1036 | test { |
| ... | ... | @@ -1139,7 +1139,7 @@ pub fn checkAllAllocationFailures( |
| 1139 | 1139 | } else |err| switch (err) { |
| 1140 | 1140 | error.OutOfMemory => { |
| 1141 | 1141 | if (failing_allocator_inst.allocated_bytes != failing_allocator_inst.freed_bytes) { |
| 1142 | | print( |
| 1142 | failPrint( |
| 1143 | 1143 | "\nfail_index: {d}/{d}\nallocated bytes: {d}\nfreed bytes: {d}\nallocations: {d}\ndeallocations: {d}\nallocation that was made to fail: {f}", |
| 1144 | 1144 | .{ |
| 1145 | 1145 | fail_index, |