Skip to content

Commit dc9ebff

Browse files
Make tests less confusing
1 parent af0c869 commit dc9ebff

1 file changed

Lines changed: 56 additions & 56 deletions

File tree

tests/ErrorBuilder.zig

Lines changed: 56 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -564,142 +564,142 @@ test "ErrorBuilder - file name visibility" {
564564
defer eb.deinit();
565565

566566
try eb.addFile("basic.zig",
567+
\\// comment
567568
\\const alpha: bool = true;
568-
\\// ^^^^^ (bool)()
569+
\\// comment
569570
\\const beta: bool = false;
570-
\\// ^^^^ (bool)()
571+
\\// comment
571572
\\const gamma: type = bool;
572-
\\// ^^^^^ (type)(bool)
573573
);
574574

575575
try eb.addFile("array.zig",
576+
\\// comment
576577
\\const array_slice_open_runtime = some_array[runtime_index..];
577-
\\// ^^^^^^^^^^^^^^^^^^^^^^^^ ([]const u8)()
578+
\\// comment
578579
\\const array_slice_0_2 = some_array[0..2];
579-
\\// ^^^^^^^^^^^^^^^ (*const [2]u8)()
580+
\\// comment
580581
\\const array_slice_0_2_sentinel = some_array[0..2 :0];
581-
\\// ^^^^^^^^^^^^^^^^^^^^^^^^ (*const [2]u8)()
582+
\\// comment
582583
\\const array_slice_0_5 = some_array[0..5];
583-
\\// ^^^^^^^^^^^^^^^ (*const [?]u8)()
584+
\\// comment
584585
\\const array_slice_3_2 = some_array[3..2];
585-
\\// ^^^^^^^^^^^^^^^ (*const [?]u8)()
586+
\\// comment
586587
\\const array_slice_0_runtime = some_array[0..runtime_index];
587-
\\// ^^^^^^^^^^^^^^^^^^^^^ ([]const u8)()
588+
\\// comment
588589
\\const array_slice_with_sentinel = some_array[0..runtime_index :0];
589-
\\// ^^^^^^^^^^^^^^^^^^^^^^^^^ ([]const u8)()
590+
\\// comment
590591
\\const array_init = [length]u8{};
591-
\\// ^^^^^^^^^^ ([3]u8)()
592+
\\// comment
592593
\\const array_init_inferred_len_0 = [_]u8{};
593-
\\// ^^^^^^^^^^^^^^^^^^^^^^^^^ ([0]u8)()
594+
\\// comment
594595
\\const array_init_inferred_len_3 = [_]u8{ 1, 2, 3 };
595-
\\// ^^^^^^^^^^^^^^^^^^^^^^^^^ ([3]u8)()
596596
);
597597

598598
try eb.addFile("sentinel_value.zig",
599+
\\// comment
599600
\\const hw = "Hello, World!";
600-
\\// ^^ (*const [13:0]u8)(
601+
\\// comment
601602
\\const h = hw[0..5];
602-
\\// ^ (unknown)()
603+
\\// comment
603604
\\const w = hw[7..];
604-
\\// ^ (unknown)()
605605
);
606606

607-
try eb.msgAtLoc("this should be `*const [2:0]u8`", "array.zig", .{ .start = 195, .end = 219 }, .err, .{});
608-
try eb.msgAtLoc("this should be `[:0]const u8`", "array.zig", .{ .start = 562, .end = 587 }, .err, .{});
607+
try eb.msgAtLoc("this should be `*const [2:0]u8`", "array.zig", .{ .start = 143, .end = 143 + 24 }, .err, .{});
608+
try eb.msgAtLoc("this should be `[:0]const u8`", "array.zig", .{ .start = 385, .end = 385 + 25 }, .err, .{});
609609

610-
try eb.msgAtLoc("this should be `*const [5]u8`", "sentinel_value.zig", .{ .start = 62, .end = 63 }, .err, .{});
611-
try eb.msgAtLoc("this should be `*const [6:0]u8`", "sentinel_value.zig", .{ .start = 102, .end = 103 }, .err, .{});
610+
try eb.msgAtLoc("this should be `*const [5]u8`", "sentinel_value.zig", .{ .start = 56, .end = 57 }, .err, .{});
611+
try eb.msgAtLoc("this should be `*const [6:0]u8`", "sentinel_value.zig", .{ .start = 87, .end = 88 }, .err, .{});
612612

613613
eb.file_name_visibility = .multi_file;
614614
try std.testing.expectFmt(
615615
\\array.zig:
616-
\\// ^^^^^^^^^^^^^^^^^^^^^^^^ ([]const u8)()
616+
\\// comment
617617
\\const array_slice_0_2 = some_array[0..2];
618-
\\// ^^^^^^^^^^^^^^^ (*const [2]u8)()
618+
\\// comment
619619
\\const array_slice_0_2_sentinel = some_array[0..2 :0];
620620
\\ ^^^^^^^^^^^^^^^^^^^^^^^^ error: this should be `*const [2:0]u8`
621-
\\// ^^^^^^^^^^^^^^^^^^^^^^^^ (*const [2]u8)()
621+
\\// comment
622622
\\const array_slice_0_5 = some_array[0..5];
623-
\\// ^^^^^^^^^^^^^^^ (*const [?]u8)()
623+
\\// comment
624624
\\...
625-
\\// ^^^^^^^^^^^^^^^ (*const [?]u8)()
625+
\\// comment
626626
\\const array_slice_0_runtime = some_array[0..runtime_index];
627-
\\// ^^^^^^^^^^^^^^^^^^^^^ ([]const u8)()
627+
\\// comment
628628
\\const array_slice_with_sentinel = some_array[0..runtime_index :0];
629629
\\ ^^^^^^^^^^^^^^^^^^^^^^^^^ error: this should be `[:0]const u8`
630-
\\// ^^^^^^^^^^^^^^^^^^^^^^^^^ ([]const u8)()
630+
\\// comment
631631
\\const array_init = [length]u8{};
632-
\\// ^^^^^^^^^^ ([3]u8)()
632+
\\// comment
633633
\\
634634
\\sentinel_value.zig:
635+
\\// comment
635636
\\const hw = "Hello, World!";
636-
\\// ^^ (*const [13:0]u8)(
637+
\\// comment
637638
\\const h = hw[0..5];
638639
\\ ^ error: this should be `*const [5]u8`
639-
\\// ^ (unknown)()
640+
\\// comment
640641
\\const w = hw[7..];
641642
\\ ^ error: this should be `*const [6:0]u8`
642-
\\// ^ (unknown)()
643643
, "{}", .{eb});
644644

645645
eb.file_name_visibility = .always;
646646
try std.testing.expectFmt(
647-
\\array.zig:5:7:
648-
\\// ^^^^^^^^^^^^^^^^^^^^^^^^ ([]const u8)()
647+
\\array.zig:6:7:
648+
\\// comment
649649
\\const array_slice_0_2 = some_array[0..2];
650-
\\// ^^^^^^^^^^^^^^^ (*const [2]u8)()
650+
\\// comment
651651
\\const array_slice_0_2_sentinel = some_array[0..2 :0];
652652
\\ ^^^^^^^^^^^^^^^^^^^^^^^^ error: this should be `*const [2:0]u8`
653-
\\// ^^^^^^^^^^^^^^^^^^^^^^^^ (*const [2]u8)()
653+
\\// comment
654654
\\const array_slice_0_5 = some_array[0..5];
655-
\\// ^^^^^^^^^^^^^^^ (*const [?]u8)()
655+
\\// comment
656656
\\
657-
\\array.zig:13:7:
658-
\\// ^^^^^^^^^^^^^^^ (*const [?]u8)()
657+
\\array.zig:14:7:
658+
\\// comment
659659
\\const array_slice_0_runtime = some_array[0..runtime_index];
660-
\\// ^^^^^^^^^^^^^^^^^^^^^ ([]const u8)()
660+
\\// comment
661661
\\const array_slice_with_sentinel = some_array[0..runtime_index :0];
662662
\\ ^^^^^^^^^^^^^^^^^^^^^^^^^ error: this should be `[:0]const u8`
663-
\\// ^^^^^^^^^^^^^^^^^^^^^^^^^ ([]const u8)()
663+
\\// comment
664664
\\const array_init = [length]u8{};
665-
\\// ^^^^^^^^^^ ([3]u8)()
665+
\\// comment
666666
\\
667-
\\sentinel_value.zig:3:7:
667+
\\sentinel_value.zig:4:7:
668+
\\// comment
668669
\\const hw = "Hello, World!";
669-
\\// ^^ (*const [13:0]u8)(
670+
\\// comment
670671
\\const h = hw[0..5];
671672
\\ ^ error: this should be `*const [5]u8`
672-
\\// ^ (unknown)()
673+
\\// comment
673674
\\const w = hw[7..];
674675
\\ ^ error: this should be `*const [6:0]u8`
675-
\\// ^ (unknown)()
676676
, "{}", .{eb});
677677

678678
eb.file_name_visibility = .never;
679679
try std.testing.expectFmt(
680-
\\// ^^^^^^^^^^^^^^^^^^^^^^^^ ([]const u8)()
680+
\\// comment
681681
\\const array_slice_0_2 = some_array[0..2];
682-
\\// ^^^^^^^^^^^^^^^ (*const [2]u8)()
682+
\\// comment
683683
\\const array_slice_0_2_sentinel = some_array[0..2 :0];
684684
\\ ^^^^^^^^^^^^^^^^^^^^^^^^ error: this should be `*const [2:0]u8`
685-
\\// ^^^^^^^^^^^^^^^^^^^^^^^^ (*const [2]u8)()
685+
\\// comment
686686
\\const array_slice_0_5 = some_array[0..5];
687-
\\// ^^^^^^^^^^^^^^^ (*const [?]u8)()
688-
\\// ^^^^^^^^^^^^^^^ (*const [?]u8)()
687+
\\// comment
688+
\\// comment
689689
\\const array_slice_0_runtime = some_array[0..runtime_index];
690-
\\// ^^^^^^^^^^^^^^^^^^^^^ ([]const u8)()
690+
\\// comment
691691
\\const array_slice_with_sentinel = some_array[0..runtime_index :0];
692692
\\ ^^^^^^^^^^^^^^^^^^^^^^^^^ error: this should be `[:0]const u8`
693-
\\// ^^^^^^^^^^^^^^^^^^^^^^^^^ ([]const u8)()
693+
\\// comment
694694
\\const array_init = [length]u8{};
695-
\\// ^^^^^^^^^^ ([3]u8)()
695+
\\// comment
696+
\\// comment
696697
\\const hw = "Hello, World!";
697-
\\// ^^ (*const [13:0]u8)(
698+
\\// comment
698699
\\const h = hw[0..5];
699700
\\ ^ error: this should be `*const [5]u8`
700-
\\// ^ (unknown)()
701+
\\// comment
701702
\\const w = hw[7..];
702703
\\ ^ error: this should be `*const [6:0]u8`
703-
\\// ^ (unknown)()
704704
, "{}", .{eb});
705705
}

0 commit comments

Comments
 (0)