Add test for `@typeInfo` declarations showing up in declaration order
Both the stage1 and std lib HashMap implementations now preserve insertion ordermaster
parent
2e037fd827
commit
2e6688ae27
|
@ -409,3 +409,19 @@ test "type info: value is correctly copied" {
|
|||
expect(@typeInfo([]u32).Pointer.size == .Slice);
|
||||
}
|
||||
}
|
||||
|
||||
test "Declarations are returned in declaration order" {
|
||||
const S = struct {
|
||||
const a = 1;
|
||||
const b = 2;
|
||||
const c = 3;
|
||||
const d = 4;
|
||||
const e = 5;
|
||||
};
|
||||
const d = @typeInfo(S).Struct.decls;
|
||||
expect(std.mem.eql(u8, d[0].name, "a"));
|
||||
expect(std.mem.eql(u8, d[1].name, "b"));
|
||||
expect(std.mem.eql(u8, d[2].name, "c"));
|
||||
expect(std.mem.eql(u8, d[3].name, "d"));
|
||||
expect(std.mem.eql(u8, d[4].name, "e"));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue