authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-02-25 21:24:27-05:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-02-25 21:24:27-05:00
loge75598af3d011c6277d9d715f39d112db948d5e0
tree58cd324bd8da12521d4cc31e59b6dd86ff9a8c12
parentdad62a7e27fb7e8ea1eb51d6619fd534106417f1
signature Commit is signed but in an unrecognized format.

add test case to catch regression from previous commit

Once this test case is passing, previous commit can be re-added. Closes #4560

2 files changed, 33 insertions(+), 0 deletions(-)

test/stage1/behavior.zig+1
......@@ -40,6 +40,7 @@ comptime {
4040 _ = @import("behavior/bugs/3384.zig");
4141 _ = @import("behavior/bugs/3586.zig");
4242 _ = @import("behavior/bugs/3742.zig");
43 _ = @import("behavior/bugs/4560.zig");
4344 _ = @import("behavior/bugs/394.zig");
4445 _ = @import("behavior/bugs/421.zig");
4546 _ = @import("behavior/bugs/529.zig");
test/stage1/behavior/bugs/4560.zig created+32
......@@ -0,0 +1,32 @@
1const std = @import("std");
2
3test "fixed" {
4 var s: S = .{
5 .a = 1,
6 .b = .{
7 .size = 123,
8 .max_distance_from_start_index = 456,
9 },
10 };
11 std.testing.expect(s.a == 1);
12 std.testing.expect(s.b.size == 123);
13 std.testing.expect(s.b.max_distance_from_start_index == 456);
14}
15
16const S = struct {
17 a: u32,
18 b: Map,
19
20 const Map = std.StringHashMap(*S);
21};
22
23pub fn StringHashMap(comptime V: type) type {
24 return HashMap([]const u8, V);
25}
26
27pub fn HashMap(comptime K: type, comptime V: type) type {
28 return struct {
29 size: usize,
30 max_distance_from_start_index: usize,
31 };
32}