| author | |
| committer | |
| log | 4ca1f4ec2e3ae1a08295bc6ed03c235cb7700ab9 |
| tree | b4b2cbaae3709b49cb435724d8de42da7d6d8280 |
| parent | 57b2176e28fd336309922cc9182cffcf084c1879 |
| parent | 134f5fd3d690cfdce2ab7d622cb233b3e510bf3a |
| signature |
stage1: don't filter test blocks with empty label30 files changed, 40 insertions(+), 35 deletions(-)
lib/std/Thread.zig+1-1| ... | @@ -553,7 +553,7 @@ pub fn getCurrentThreadId() u64 { | ... | @@ -553,7 +553,7 @@ pub fn getCurrentThreadId() u64 { |
| 553 | } | 553 | } |
| 554 | } | 554 | } |
| 555 | 555 | ||
| 556 | test "" { | 556 | test { |
| 557 | if (!builtin.single_threaded) { | 557 | if (!builtin.single_threaded) { |
| 558 | std.testing.refAllDecls(@This()); | 558 | std.testing.refAllDecls(@This()); |
| 559 | } | 559 | } |
lib/std/build.zig+1-1| ... | @@ -2985,7 +2985,7 @@ test "LibExeObjStep.addPackage" { | ... | @@ -2985,7 +2985,7 @@ test "LibExeObjStep.addPackage" { |
| 2985 | std.testing.expectEqualStrings(pkg_top.name, dupe.name); | 2985 | std.testing.expectEqualStrings(pkg_top.name, dupe.name); |
| 2986 | } | 2986 | } |
| 2987 | 2987 | ||
| 2988 | test "" { | 2988 | test { |
| 2989 | // The only purpose of this test is to get all these untested functions | 2989 | // The only purpose of this test is to get all these untested functions |
| 2990 | // to be referenced to avoid regression so it is okay to skip some targets. | 2990 | // to be referenced to avoid regression so it is okay to skip some targets. |
| 2991 | if (comptime std.Target.current.cpu.arch.ptrBitWidth() == 64) { | 2991 | if (comptime std.Target.current.cpu.arch.ptrBitWidth() == 64) { |
lib/std/build/emit_raw.zig+1-1| ... | @@ -223,6 +223,6 @@ pub const InstallRawStep = struct { | ... | @@ -223,6 +223,6 @@ pub const InstallRawStep = struct { |
| 223 | } | 223 | } |
| 224 | }; | 224 | }; |
| 225 | 225 | ||
| 226 | test "" { | 226 | test { |
| 227 | std.testing.refAllDecls(InstallRawStep); | 227 | std.testing.refAllDecls(InstallRawStep); |
| 228 | } | 228 | } |
lib/std/c.zig+1-1| ... | @@ -14,7 +14,7 @@ pub const parse = @import("c/parse.zig").parse; | ... | @@ -14,7 +14,7 @@ pub const parse = @import("c/parse.zig").parse; |
| 14 | pub const ast = @import("c/ast.zig"); | 14 | pub const ast = @import("c/ast.zig"); |
| 15 | pub const builtins = @import("c/builtins.zig"); | 15 | pub const builtins = @import("c/builtins.zig"); |
| 16 | 16 | ||
| 17 | test "" { | 17 | test { |
| 18 | _ = tokenizer; | 18 | _ = tokenizer; |
| 19 | } | 19 | } |
| 20 | 20 |
lib/std/compress.zig+1-1| ... | @@ -9,7 +9,7 @@ pub const deflate = @import("compress/deflate.zig"); | ... | @@ -9,7 +9,7 @@ pub const deflate = @import("compress/deflate.zig"); |
| 9 | pub const gzip = @import("compress/gzip.zig"); | 9 | pub const gzip = @import("compress/gzip.zig"); |
| 10 | pub const zlib = @import("compress/zlib.zig"); | 10 | pub const zlib = @import("compress/zlib.zig"); |
| 11 | 11 | ||
| 12 | test "" { | 12 | test { |
| 13 | _ = gzip; | 13 | _ = gzip; |
| 14 | _ = zlib; | 14 | _ = zlib; |
| 15 | } | 15 | } |
lib/std/fs.zig+1-1| ... | @@ -2475,7 +2475,7 @@ fn copy_file(fd_in: os.fd_t, fd_out: os.fd_t) CopyFileError!void { | ... | @@ -2475,7 +2475,7 @@ fn copy_file(fd_in: os.fd_t, fd_out: os.fd_t) CopyFileError!void { |
| 2475 | } | 2475 | } |
| 2476 | } | 2476 | } |
| 2477 | 2477 | ||
| 2478 | test "" { | 2478 | test { |
| 2479 | if (builtin.os.tag != .wasi) { | 2479 | if (builtin.os.tag != .wasi) { |
| 2480 | _ = makeDirAbsolute; | 2480 | _ = makeDirAbsolute; |
| 2481 | _ = makeDirAbsoluteZ; | 2481 | _ = makeDirAbsoluteZ; |
lib/std/io.zig+1-1| ... | @@ -171,7 +171,7 @@ test "null_writer" { | ... | @@ -171,7 +171,7 @@ test "null_writer" { |
| 171 | null_writer.writeAll("yay" ** 10) catch |err| switch (err) {}; | 171 | null_writer.writeAll("yay" ** 10) catch |err| switch (err) {}; |
| 172 | } | 172 | } |
| 173 | 173 | ||
| 174 | test "" { | 174 | test { |
| 175 | _ = @import("io/bit_reader.zig"); | 175 | _ = @import("io/bit_reader.zig"); |
| 176 | _ = @import("io/bit_writer.zig"); | 176 | _ = @import("io/bit_writer.zig"); |
| 177 | _ = @import("io/buffered_atomic_file.zig"); | 177 | _ = @import("io/buffered_atomic_file.zig"); |
lib/std/io/c_writer.zig+1-1| ... | @@ -34,7 +34,7 @@ fn cWriterWrite(c_file: *std.c.FILE, bytes: []const u8) std.fs.File.WriteError!u | ... | @@ -34,7 +34,7 @@ fn cWriterWrite(c_file: *std.c.FILE, bytes: []const u8) std.fs.File.WriteError!u |
| 34 | } | 34 | } |
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | test "" { | 37 | test { |
| 38 | if (!builtin.link_libc) return error.SkipZigTest; | 38 | if (!builtin.link_libc) return error.SkipZigTest; |
| 39 | 39 | ||
| 40 | const filename = "tmp_io_test_file.txt"; | 40 | const filename = "tmp_io_test_file.txt"; |
lib/std/math.zig+1-1| ... | @@ -278,7 +278,7 @@ pub const Complex = complex.Complex; | ... | @@ -278,7 +278,7 @@ pub const Complex = complex.Complex; |
| 278 | 278 | ||
| 279 | pub const big = @import("math/big.zig"); | 279 | pub const big = @import("math/big.zig"); |
| 280 | 280 | ||
| 281 | test "" { | 281 | test { |
| 282 | std.testing.refAllDecls(@This()); | 282 | std.testing.refAllDecls(@This()); |
| 283 | } | 283 | } |
| 284 | 284 |
lib/std/math/big.zig+1-1| ... | @@ -20,7 +20,7 @@ comptime { | ... | @@ -20,7 +20,7 @@ comptime { |
| 20 | assert(limb_info.signedness == .unsigned); | 20 | assert(limb_info.signedness == .unsigned); |
| 21 | } | 21 | } |
| 22 | 22 | ||
| 23 | test "" { | 23 | test { |
| 24 | _ = int; | 24 | _ = int; |
| 25 | _ = Rational; | 25 | _ = Rational; |
| 26 | _ = Limb; | 26 | _ = Limb; |
lib/std/math/big/int.zig+1-1| ... | @@ -2344,6 +2344,6 @@ fn fixedIntFromSignedDoubleLimb(A: SignedDoubleLimb, storage: []Limb) Mutable { | ... | @@ -2344,6 +2344,6 @@ fn fixedIntFromSignedDoubleLimb(A: SignedDoubleLimb, storage: []Limb) Mutable { |
| 2344 | }; | 2344 | }; |
| 2345 | } | 2345 | } |
| 2346 | 2346 | ||
| 2347 | test "" { | 2347 | test { |
| 2348 | _ = @import("int_test.zig"); | 2348 | _ = @import("int_test.zig"); |
| 2349 | } | 2349 | } |
lib/std/net.zig+1-1| ... | @@ -1769,6 +1769,6 @@ pub const StreamServer = struct { | ... | @@ -1769,6 +1769,6 @@ pub const StreamServer = struct { |
| 1769 | } | 1769 | } |
| 1770 | }; | 1770 | }; |
| 1771 | 1771 | ||
| 1772 | test "" { | 1772 | test { |
| 1773 | _ = @import("net/test.zig"); | 1773 | _ = @import("net/test.zig"); |
| 1774 | } | 1774 | } |
lib/std/os.zig+1-1| ... | @@ -43,7 +43,7 @@ comptime { | ... | @@ -43,7 +43,7 @@ comptime { |
| 43 | assert(@import("std") == std); // std lib tests require --override-lib-dir | 43 | assert(@import("std") == std); // std lib tests require --override-lib-dir |
| 44 | } | 44 | } |
| 45 | 45 | ||
| 46 | test "" { | 46 | test { |
| 47 | _ = darwin; | 47 | _ = darwin; |
| 48 | _ = freebsd; | 48 | _ = freebsd; |
| 49 | _ = linux; | 49 | _ = linux; |
lib/std/os/linux.zig+1-1| ... | @@ -1355,7 +1355,7 @@ pub fn madvise(address: [*]u8, len: usize, advice: u32) usize { | ... | @@ -1355,7 +1355,7 @@ pub fn madvise(address: [*]u8, len: usize, advice: u32) usize { |
| 1355 | return syscall3(.madvise, @ptrToInt(address), len, advice); | 1355 | return syscall3(.madvise, @ptrToInt(address), len, advice); |
| 1356 | } | 1356 | } |
| 1357 | 1357 | ||
| 1358 | test "" { | 1358 | test { |
| 1359 | if (builtin.os.tag == .linux) { | 1359 | if (builtin.os.tag == .linux) { |
| 1360 | _ = @import("linux/test.zig"); | 1360 | _ = @import("linux/test.zig"); |
| 1361 | } | 1361 | } |
lib/std/rand.zig+1-1| ... | @@ -602,6 +602,6 @@ test "CSPRNG" { | ... | @@ -602,6 +602,6 @@ test "CSPRNG" { |
| 602 | expect(a ^ b ^ c != 0); | 602 | expect(a ^ b ^ c != 0); |
| 603 | } | 603 | } |
| 604 | 604 | ||
| 605 | test "" { | 605 | test { |
| 606 | std.testing.refAllDecls(@This()); | 606 | std.testing.refAllDecls(@This()); |
| 607 | } | 607 | } |
lib/std/special/compiler_rt/shift.zig+1-1| ... | @@ -124,7 +124,7 @@ pub fn __aeabi_llsr(a: i64, b: i32) callconv(.AAPCS) i64 { | ... | @@ -124,7 +124,7 @@ pub fn __aeabi_llsr(a: i64, b: i32) callconv(.AAPCS) i64 { |
| 124 | return __lshrdi3(a, b); | 124 | return __lshrdi3(a, b); |
| 125 | } | 125 | } |
| 126 | 126 | ||
| 127 | test "" { | 127 | test { |
| 128 | _ = @import("ashrdi3_test.zig"); | 128 | _ = @import("ashrdi3_test.zig"); |
| 129 | _ = @import("ashrti3_test.zig"); | 129 | _ = @import("ashrti3_test.zig"); |
| 130 | 130 |
lib/std/special/compiler_rt/sparc.zig-1| ... | @@ -68,7 +68,6 @@ pub fn _Qp_fge(a: *f128, b: *f128) callconv(.C) bool { | ... | @@ -68,7 +68,6 @@ pub fn _Qp_fge(a: *f128, b: *f128) callconv(.C) bool { |
| 68 | return cmp == @enumToInt(FCMP.Greater) or cmp == @enumToInt(FCMP.Equal); | 68 | return cmp == @enumToInt(FCMP.Greater) or cmp == @enumToInt(FCMP.Equal); |
| 69 | } | 69 | } |
| 70 | 70 | ||
| 71 | |||
| 72 | // Casting | 71 | // Casting |
| 73 | 72 | ||
| 74 | pub fn _Qp_dtoq(c: *f128, a: f64) callconv(.C) void { | 73 | pub fn _Qp_dtoq(c: *f128, a: f64) callconv(.C) void { |
lib/std/std.zig+1-1| ... | @@ -86,7 +86,7 @@ comptime { | ... | @@ -86,7 +86,7 @@ comptime { |
| 86 | _ = start; | 86 | _ = start; |
| 87 | } | 87 | } |
| 88 | 88 | ||
| 89 | test "" { | 89 | test { |
| 90 | if (builtin.os.tag == .windows) { | 90 | if (builtin.os.tag == .windows) { |
| 91 | // We only test the Windows-relevant stuff to save memory because the CI | 91 | // We only test the Windows-relevant stuff to save memory because the CI |
| 92 | // server is hitting OOM. TODO revert this after stage2 arrives. | 92 | // server is hitting OOM. TODO revert this after stage2 arrives. |
lib/std/target.zig+1-1| ... | @@ -1577,6 +1577,6 @@ pub const Target = struct { | ... | @@ -1577,6 +1577,6 @@ pub const Target = struct { |
| 1577 | } | 1577 | } |
| 1578 | }; | 1578 | }; |
| 1579 | 1579 | ||
| 1580 | test "" { | 1580 | test { |
| 1581 | std.testing.refAllDecls(Target.Cpu.Arch); | 1581 | std.testing.refAllDecls(Target.Cpu.Arch); |
| 1582 | } | 1582 | } |
lib/std/testing.zig+1-1| ... | @@ -443,7 +443,7 @@ fn printLine(line: []const u8) void { | ... | @@ -443,7 +443,7 @@ fn printLine(line: []const u8) void { |
| 443 | print("{s}\n", .{line}); | 443 | print("{s}\n", .{line}); |
| 444 | } | 444 | } |
| 445 | 445 | ||
| 446 | test "" { | 446 | test { |
| 447 | expectEqualStrings("foo", "foo"); | 447 | expectEqualStrings("foo", "foo"); |
| 448 | } | 448 | } |
| 449 | 449 |
lib/std/valgrind.zig+1-1| ... | @@ -262,7 +262,7 @@ pub fn monitorCommand(command: [*]u8) bool { | ... | @@ -262,7 +262,7 @@ pub fn monitorCommand(command: [*]u8) bool { |
| 262 | pub const memcheck = @import("valgrind/memcheck.zig"); | 262 | pub const memcheck = @import("valgrind/memcheck.zig"); |
| 263 | pub const callgrind = @import("valgrind/callgrind.zig"); | 263 | pub const callgrind = @import("valgrind/callgrind.zig"); |
| 264 | 264 | ||
| 265 | test "" { | 265 | test { |
| 266 | _ = @import("valgrind/memcheck.zig"); | 266 | _ = @import("valgrind/memcheck.zig"); |
| 267 | _ = @import("valgrind/callgrind.zig"); | 267 | _ = @import("valgrind/callgrind.zig"); |
| 268 | } | 268 | } |
lib/std/zig.zig+1-1| ... | @@ -255,6 +255,6 @@ test "parseCharLiteral" { | ... | @@ -255,6 +255,6 @@ test "parseCharLiteral" { |
| 255 | std.testing.expectError(error.InvalidCharacter, parseCharLiteral("'\\u{FFFF}x'", &bad_index)); | 255 | std.testing.expectError(error.InvalidCharacter, parseCharLiteral("'\\u{FFFF}x'", &bad_index)); |
| 256 | } | 256 | } |
| 257 | 257 | ||
| 258 | test "" { | 258 | test { |
| 259 | @import("std").testing.refAllDecls(@This()); | 259 | @import("std").testing.refAllDecls(@This()); |
| 260 | } | 260 | } |
lib/std/zig/ast.zig+1-1| ... | @@ -3231,7 +3231,7 @@ pub const Node = struct { | ... | @@ -3231,7 +3231,7 @@ pub const Node = struct { |
| 3231 | base: Node = Node{ .tag = .TestDecl }, | 3231 | base: Node = Node{ .tag = .TestDecl }, |
| 3232 | doc_comments: ?*DocComment, | 3232 | doc_comments: ?*DocComment, |
| 3233 | test_token: TokenIndex, | 3233 | test_token: TokenIndex, |
| 3234 | name: *Node, | 3234 | name: ?*Node, |
| 3235 | body_node: *Node, | 3235 | body_node: *Node, |
| 3236 | 3236 | ||
| 3237 | pub fn iterate(self: *const TestDecl, index: usize) ?*Node { | 3237 | pub fn iterate(self: *const TestDecl, index: usize) ?*Node { |
lib/std/zig/parse.zig+1-3| ... | @@ -366,9 +366,7 @@ const Parser = struct { | ... | @@ -366,9 +366,7 @@ const Parser = struct { |
| 366 | /// TestDecl <- KEYWORD_test STRINGLITERALSINGLE Block | 366 | /// TestDecl <- KEYWORD_test STRINGLITERALSINGLE Block |
| 367 | fn parseTestDecl(p: *Parser) !?*Node { | 367 | fn parseTestDecl(p: *Parser) !?*Node { |
| 368 | const test_token = p.eatToken(.Keyword_test) orelse return null; | 368 | const test_token = p.eatToken(.Keyword_test) orelse return null; |
| 369 | const name_node = try p.expectNode(parseStringLiteralSingle, .{ | 369 | const name_node = try p.parseStringLiteralSingle(); |
| 370 | .ExpectedStringLiteral = .{ .token = p.tok_i }, | ||
| 371 | }); | ||
| 372 | const block_node = (try p.parseBlock(null)) orelse { | 370 | const block_node = (try p.parseBlock(null)) orelse { |
| 373 | try p.errors.append(p.gpa, .{ .ExpectedLBrace = .{ .token = p.tok_i } }); | 371 | try p.errors.append(p.gpa, .{ .ExpectedLBrace = .{ .token = p.tok_i } }); |
| 374 | return error.ParseError; | 372 | return error.ParseError; |
lib/std/zig/render.zig+2-1| ... | @@ -228,7 +228,8 @@ fn renderContainerDecl(allocator: *mem.Allocator, ais: anytype, tree: *ast.Tree, | ... | @@ -228,7 +228,8 @@ fn renderContainerDecl(allocator: *mem.Allocator, ais: anytype, tree: *ast.Tree, |
| 228 | 228 | ||
| 229 | try renderDocComments(tree, ais, test_decl, test_decl.doc_comments); | 229 | try renderDocComments(tree, ais, test_decl, test_decl.doc_comments); |
| 230 | try renderToken(tree, ais, test_decl.test_token, .Space); | 230 | try renderToken(tree, ais, test_decl.test_token, .Space); |
| 231 | try renderExpression(allocator, ais, tree, test_decl.name, .Space); | 231 | if (test_decl.name) |name| |
| 232 | try renderExpression(allocator, ais, tree, name, .Space); | ||
| 232 | try renderExpression(allocator, ais, tree, test_decl.body_node, space); | 233 | try renderExpression(allocator, ais, tree, test_decl.body_node, space); |
| 233 | }, | 234 | }, |
| 234 | 235 |
lib/std/zig/system.zig+1-1| ... | @@ -898,6 +898,6 @@ pub const NativeTargetInfo = struct { | ... | @@ -898,6 +898,6 @@ pub const NativeTargetInfo = struct { |
| 898 | } | 898 | } |
| 899 | }; | 899 | }; |
| 900 | 900 | ||
| 901 | test "" { | 901 | test { |
| 902 | _ = @import("system/macos.zig"); | 902 | _ = @import("system/macos.zig"); |
| 903 | } | 903 | } |
src/codegen/aarch64.zig+1-1| ... | @@ -906,7 +906,7 @@ pub const Instruction = union(enum) { | ... | @@ -906,7 +906,7 @@ pub const Instruction = union(enum) { |
| 906 | } | 906 | } |
| 907 | }; | 907 | }; |
| 908 | 908 | ||
| 909 | test "" { | 909 | test { |
| 910 | testing.refAllDecls(@This()); | 910 | testing.refAllDecls(@This()); |
| 911 | } | 911 | } |
| 912 | 912 |
src/stage1/all_types.hpp+1| ... | @@ -797,6 +797,7 @@ struct AstNodeVariableDeclaration { | ... | @@ -797,6 +797,7 @@ struct AstNodeVariableDeclaration { |
| 797 | }; | 797 | }; |
| 798 | 798 | ||
| 799 | struct AstNodeTestDecl { | 799 | struct AstNodeTestDecl { |
| 800 | // nullptr if the test declaration has no name | ||
| 800 | Buf *name; | 801 | Buf *name; |
| 801 | 802 | ||
| 802 | AstNode *body; | 803 | AstNode *body; |
src/stage1/analyze.cpp+10-4| ... | @@ -3871,12 +3871,18 @@ static void preview_test_decl(CodeGen *g, AstNode *node, ScopeDecls *decls_scope | ... | @@ -3871,12 +3871,18 @@ static void preview_test_decl(CodeGen *g, AstNode *node, ScopeDecls *decls_scope |
| 3871 | return; | 3871 | return; |
| 3872 | 3872 | ||
| 3873 | Buf *decl_name_buf = node->data.test_decl.name; | 3873 | Buf *decl_name_buf = node->data.test_decl.name; |
| 3874 | Buf *test_name; | ||
| 3874 | 3875 | ||
| 3875 | Buf *test_name = g->test_name_prefix ? | 3876 | if (decl_name_buf != nullptr) { |
| 3876 | buf_sprintf("%s%s", buf_ptr(g->test_name_prefix), buf_ptr(decl_name_buf)) : decl_name_buf; | 3877 | test_name = g->test_name_prefix ? |
| 3878 | buf_sprintf("%s%s", buf_ptr(g->test_name_prefix), buf_ptr(decl_name_buf)) : decl_name_buf; | ||
| 3877 | 3879 | ||
| 3878 | if (g->test_filter != nullptr && strstr(buf_ptr(test_name), buf_ptr(g->test_filter)) == nullptr) { | 3880 | if (g->test_filter != nullptr && strstr(buf_ptr(test_name), buf_ptr(g->test_filter)) == nullptr) { |
| 3879 | return; | 3881 | return; |
| 3882 | } | ||
| 3883 | } else { | ||
| 3884 | // Unnamed test blocks are always executed. | ||
| 3885 | test_name = buf_sprintf("%s", g->test_name_prefix ? buf_ptr(g->test_name_prefix) : ""); | ||
| 3880 | } | 3886 | } |
| 3881 | 3887 | ||
| 3882 | TldFn *tld_fn = heap::c_allocator.create<TldFn>(); | 3888 | TldFn *tld_fn = heap::c_allocator.create<TldFn>(); |
src/stage1/parser.cpp+2-2| ... | @@ -658,10 +658,10 @@ static AstNode *ast_parse_test_decl(ParseContext *pc) { | ... | @@ -658,10 +658,10 @@ static AstNode *ast_parse_test_decl(ParseContext *pc) { |
| 658 | if (test == nullptr) | 658 | if (test == nullptr) |
| 659 | return nullptr; | 659 | return nullptr; |
| 660 | 660 | ||
| 661 | Token *name = expect_token(pc, TokenIdStringLiteral); | 661 | Token *name = eat_token_if(pc, TokenIdStringLiteral); |
| 662 | AstNode *block = ast_expect(pc, ast_parse_block); | 662 | AstNode *block = ast_expect(pc, ast_parse_block); |
| 663 | AstNode *res = ast_create_node(pc, NodeTypeTestDecl, test); | 663 | AstNode *res = ast_create_node(pc, NodeTypeTestDecl, test); |
| 664 | res->data.test_decl.name = token_buf(name); | 664 | res->data.test_decl.name = name ? token_buf(name) : nullptr; |
| 665 | res->data.test_decl.body = block; | 665 | res->data.test_decl.body = block; |
| 666 | return res; | 666 | return res; |
| 667 | } | 667 | } |