| ... | ... | @@ -409,3 +409,19 @@ test "type info: value is correctly copied" { |
| 409 | 409 | expect(@typeInfo([]u32).Pointer.size == .Slice); |
| 410 | 410 | } |
| 411 | 411 | } |
| 412 | |
| 413 | test "Declarations are returned in declaration order" { |
| 414 | const S = struct { |
| 415 | const a = 1; |
| 416 | const b = 2; |
| 417 | const c = 3; |
| 418 | const d = 4; |
| 419 | const e = 5; |
| 420 | }; |
| 421 | const d = @typeInfo(S).Struct.decls; |
| 422 | expect(std.mem.eql(u8, d[0].name, "a")); |
| 423 | expect(std.mem.eql(u8, d[1].name, "b")); |
| 424 | expect(std.mem.eql(u8, d[2].name, "c")); |
| 425 | expect(std.mem.eql(u8, d[3].name, "d")); |
| 426 | expect(std.mem.eql(u8, d[4].name, "e")); |
| 427 | } |