| author | |
| committer | |
| log | 8937f18a6f8496e011b13cb086b7948b5f1d540e |
| tree | 6db21281a31a02c2b5a6b048d891873c6f169e73 |
| parent | 17822e4a050dcbcf7fe324fcdff68887fee73ff1 |
Only about half of the tests in std were actually being run (918 vs 2144).3 files changed, 14 insertions(+), 10 deletions(-)
lib/std/testing.zig+2| ... | @@ -466,6 +466,8 @@ test { | ... | @@ -466,6 +466,8 @@ test { |
| 466 | pub fn refAllDecls(comptime T: type) void { | 466 | pub fn refAllDecls(comptime T: type) void { |
| 467 | if (!builtin.is_test) return; | 467 | if (!builtin.is_test) return; |
| 468 | inline for (comptime std.meta.declarations(T)) |decl| { | 468 | inline for (comptime std.meta.declarations(T)) |decl| { |
| 469 | if (decl.is_pub and @typeInfo(@TypeOf(@field(T, decl.name))) == .Struct) | ||
| 470 | _ = @hasDecl(@field(T, decl.name), "foo"); | ||
| 469 | _ = decl; | 471 | _ = decl; |
| 470 | } | 472 | } |
| 471 | } | 473 | } |
lib/std/zig/c_translation.zig+1-1| ... | @@ -166,7 +166,7 @@ pub fn sizeof(target: anytype) usize { | ... | @@ -166,7 +166,7 @@ pub fn sizeof(target: anytype) usize { |
| 166 | const array_info = @typeInfo(ptr.child).Array; | 166 | const array_info = @typeInfo(ptr.child).Array; |
| 167 | if ((array_info.child == u8 or array_info.child == u16) and | 167 | if ((array_info.child == u8 or array_info.child == u16) and |
| 168 | array_info.sentinel != null and | 168 | array_info.sentinel != null and |
| 169 | array_info.sentinel.? == 0) | 169 | @ptrCast(*const array_info.child, array_info.sentinel.?).* == 0) |
| 170 | { | 170 | { |
| 171 | // length of the string plus one for the null terminator. | 171 | // length of the string plus one for the null terminator. |
| 172 | return (array_info.len + 1) * @sizeOf(array_info.child); | 172 | return (array_info.len + 1) * @sizeOf(array_info.child); |
lib/std/zig/parser_test.zig+11-9| ... | @@ -585,15 +585,6 @@ test "zig fmt: asm expression with comptime content" { | ... | @@ -585,15 +585,6 @@ test "zig fmt: asm expression with comptime content" { |
| 585 | ); | 585 | ); |
| 586 | } | 586 | } |
| 587 | 587 | ||
| 588 | test "zig fmt: anytype struct field" { | ||
| 589 | try testCanonical( | ||
| 590 | \\pub const Pointer = struct { | ||
| 591 | \\ sentinel: anytype, | ||
| 592 | \\}; | ||
| 593 | \\ | ||
| 594 | ); | ||
| 595 | } | ||
| 596 | |||
| 597 | test "zig fmt: array types last token" { | 588 | test "zig fmt: array types last token" { |
| 598 | try testCanonical( | 589 | try testCanonical( |
| 599 | \\test { | 590 | \\test { |
| ... | @@ -4148,6 +4139,17 @@ test "zig fmt: container doc comments" { | ... | @@ -4148,6 +4139,17 @@ test "zig fmt: container doc comments" { |
| 4148 | ); | 4139 | ); |
| 4149 | } | 4140 | } |
| 4150 | 4141 | ||
| 4142 | test "zig fmt: anytype struct field" { | ||
| 4143 | try testError( | ||
| 4144 | \\pub const Pointer = struct { | ||
| 4145 | \\ sentinel: anytype, | ||
| 4146 | \\}; | ||
| 4147 | \\ | ||
| 4148 | , &[_]Error{ | ||
| 4149 | .expected_type_expr, | ||
| 4150 | }); | ||
| 4151 | } | ||
| 4152 | |||
| 4151 | test "zig fmt: extern without container keyword returns error" { | 4153 | test "zig fmt: extern without container keyword returns error" { |
| 4152 | try testError( | 4154 | try testError( |
| 4153 | \\const container = extern {}; | 4155 | \\const container = extern {}; |