| ... | @@ -130,6 +130,10 @@ stage1_flags: packed struct { | ... | @@ -130,6 +130,10 @@ stage1_flags: packed struct { |
| 130 | } = .{}, | 130 | } = .{}, |
| 131 | | 131 | |
| 132 | job_queued_update_builtin_zig: bool = true, | 132 | job_queued_update_builtin_zig: bool = true, |
| | 133 | /// This makes it so that we can run `zig test` on the standard library. |
| | 134 | /// Otherwise, the logic for scanning test decls skips all of them because |
| | 135 | /// `main_pkg != std_pkg`. |
| | 136 | main_pkg_is_std: bool, |
| 133 | | 137 | |
| 134 | compile_log_text: ArrayListUnmanaged(u8) = .{}, | 138 | compile_log_text: ArrayListUnmanaged(u8) = .{}, |
| 135 | | 139 | |
| ... | @@ -4528,14 +4532,22 @@ fn scanDecl(iter: *ScanDeclIter, decl_sub_index: usize, flags: u4) SemaError!voi | ... | @@ -4528,14 +4532,22 @@ fn scanDecl(iter: *ScanDeclIter, decl_sub_index: usize, flags: u4) SemaError!voi |
| 4528 | // test decl with no name. Skip the part where we check against | 4532 | // test decl with no name. Skip the part where we check against |
| 4529 | // the test name filter. | 4533 | // the test name filter. |
| 4530 | if (!mod.comp.bin_file.options.is_test) break :blk false; | 4534 | if (!mod.comp.bin_file.options.is_test) break :blk false; |
| 4531 | if (decl_pkg != mod.main_pkg) break :blk false; | 4535 | if (decl_pkg != mod.main_pkg) { |
| | 4536 | if (!mod.main_pkg_is_std) break :blk false; |
| | 4537 | const std_pkg = mod.main_pkg.table.get("std").?; |
| | 4538 | if (std_pkg != decl_pkg) break :blk false; |
| | 4539 | } |
| 4532 | try mod.test_functions.put(gpa, new_decl_index, {}); | 4540 | try mod.test_functions.put(gpa, new_decl_index, {}); |
| 4533 | break :blk true; | 4541 | break :blk true; |
| 4534 | }, | 4542 | }, |
| 4535 | else => blk: { | 4543 | else => blk: { |
| 4536 | if (!is_named_test) break :blk false; | 4544 | if (!is_named_test) break :blk false; |
| 4537 | if (!mod.comp.bin_file.options.is_test) break :blk false; | 4545 | if (!mod.comp.bin_file.options.is_test) break :blk false; |
| 4538 | if (decl_pkg != mod.main_pkg) break :blk false; | 4546 | if (decl_pkg != mod.main_pkg) { |
| | 4547 | if (!mod.main_pkg_is_std) break :blk false; |
| | 4548 | const std_pkg = mod.main_pkg.table.get("std").?; |
| | 4549 | if (std_pkg != decl_pkg) break :blk false; |
| | 4550 | } |
| 4539 | // TODO check the name against --test-filter | 4551 | // TODO check the name against --test-filter |
| 4540 | try mod.test_functions.put(gpa, new_decl_index, {}); | 4552 | try mod.test_functions.put(gpa, new_decl_index, {}); |
| 4541 | break :blk true; | 4553 | break :blk true; |