| ... | ... | @@ -331,12 +331,12 @@ const Code = struct { |
| 331 | 331 | additional_options: []const []const u8, |
| 332 | 332 | |
| 333 | 333 | const Id = union(enum) { |
| 334 | | Test, |
| 335 | | TestError: []const u8, |
| 336 | | TestSafety: []const u8, |
| 337 | | Exe: ExpectedOutcome, |
| 338 | | Obj: ?[]const u8, |
| 339 | | Lib, |
| 334 | @"test", |
| 335 | test_error: []const u8, |
| 336 | test_safety: []const u8, |
| 337 | exe: ExpectedOutcome, |
| 338 | obj: ?[]const u8, |
| 339 | lib, |
| 340 | 340 | }; |
| 341 | 341 | }; |
| 342 | 342 | |
| ... | ... | @@ -563,25 +563,25 @@ fn genToc(allocator: Allocator, tokenizer: *Tokenizer) !Toc { |
| 563 | 563 | var code_kind_id: Code.Id = undefined; |
| 564 | 564 | var just_check_syntax = false; |
| 565 | 565 | if (mem.eql(u8, code_kind_str, "exe")) { |
| 566 | | code_kind_id = Code.Id{ .Exe = .succeed }; |
| 566 | code_kind_id = Code.Id{ .exe = .succeed }; |
| 567 | 567 | } else if (mem.eql(u8, code_kind_str, "exe_err")) { |
| 568 | | code_kind_id = Code.Id{ .Exe = .fail }; |
| 568 | code_kind_id = Code.Id{ .exe = .fail }; |
| 569 | 569 | } else if (mem.eql(u8, code_kind_str, "exe_build_err")) { |
| 570 | | code_kind_id = Code.Id{ .Exe = .build_fail }; |
| 570 | code_kind_id = Code.Id{ .exe = .build_fail }; |
| 571 | 571 | } else if (mem.eql(u8, code_kind_str, "test")) { |
| 572 | | code_kind_id = Code.Id.Test; |
| 572 | code_kind_id = .@"test"; |
| 573 | 573 | } else if (mem.eql(u8, code_kind_str, "test_err")) { |
| 574 | | code_kind_id = Code.Id{ .TestError = error_str }; |
| 574 | code_kind_id = Code.Id{ .test_error = error_str }; |
| 575 | 575 | } else if (mem.eql(u8, code_kind_str, "test_safety")) { |
| 576 | | code_kind_id = Code.Id{ .TestSafety = error_str }; |
| 576 | code_kind_id = Code.Id{ .test_safety = error_str }; |
| 577 | 577 | } else if (mem.eql(u8, code_kind_str, "obj")) { |
| 578 | | code_kind_id = Code.Id{ .Obj = null }; |
| 578 | code_kind_id = Code.Id{ .obj = null }; |
| 579 | 579 | } else if (mem.eql(u8, code_kind_str, "obj_err")) { |
| 580 | | code_kind_id = Code.Id{ .Obj = error_str }; |
| 580 | code_kind_id = Code.Id{ .obj = error_str }; |
| 581 | 581 | } else if (mem.eql(u8, code_kind_str, "lib")) { |
| 582 | | code_kind_id = Code.Id.Lib; |
| 582 | code_kind_id = Code.Id.lib; |
| 583 | 583 | } else if (mem.eql(u8, code_kind_str, "syntax")) { |
| 584 | | code_kind_id = Code.Id{ .Obj = null }; |
| 584 | code_kind_id = Code.Id{ .obj = null }; |
| 585 | 585 | just_check_syntax = true; |
| 586 | 586 | } else { |
| 587 | 587 | return parseError(tokenizer, code_kind_tok, "unrecognized code kind: {s}", .{code_kind_str}); |
| ... | ... | @@ -1371,7 +1371,7 @@ fn genHtml( |
| 1371 | 1371 | var shell_out = shell_buffer.writer(); |
| 1372 | 1372 | |
| 1373 | 1373 | switch (code.id) { |
| 1374 | | Code.Id.Exe => |expected_outcome| code_block: { |
| 1374 | .exe => |expected_outcome| code_block: { |
| 1375 | 1375 | var build_args = std.ArrayList([]const u8).init(allocator); |
| 1376 | 1376 | defer build_args.deinit(); |
| 1377 | 1377 | try build_args.appendSlice(&[_][]const u8{ |
| ... | ... | @@ -1513,7 +1513,7 @@ fn genHtml( |
| 1513 | 1513 | } |
| 1514 | 1514 | try shell_out.writeAll("\n"); |
| 1515 | 1515 | }, |
| 1516 | | Code.Id.Test => { |
| 1516 | .@"test" => { |
| 1517 | 1517 | var test_args = std.ArrayList([]const u8).init(allocator); |
| 1518 | 1518 | defer test_args.deinit(); |
| 1519 | 1519 | |
| ... | ... | @@ -1565,7 +1565,7 @@ fn genHtml( |
| 1565 | 1565 | const escaped_stdout = try escapeHtml(allocator, result.stdout); |
| 1566 | 1566 | try shell_out.print("\n{s}{s}\n", .{ escaped_stderr, escaped_stdout }); |
| 1567 | 1567 | }, |
| 1568 | | Code.Id.TestError => |error_match| { |
| 1568 | .test_error => |error_match| { |
| 1569 | 1569 | var test_args = std.ArrayList([]const u8).init(allocator); |
| 1570 | 1570 | defer test_args.deinit(); |
| 1571 | 1571 | |
| ... | ... | @@ -1621,8 +1621,7 @@ fn genHtml( |
| 1621 | 1621 | const colored_stderr = try termColor(allocator, escaped_stderr); |
| 1622 | 1622 | try shell_out.print("\n{s}\n", .{colored_stderr}); |
| 1623 | 1623 | }, |
| 1624 | | |
| 1625 | | Code.Id.TestSafety => |error_match| { |
| 1624 | .test_safety => |error_match| { |
| 1626 | 1625 | var test_args = std.ArrayList([]const u8).init(allocator); |
| 1627 | 1626 | defer test_args.deinit(); |
| 1628 | 1627 | |
| ... | ... | @@ -1685,7 +1684,7 @@ fn genHtml( |
| 1685 | 1684 | colored_stderr, |
| 1686 | 1685 | }); |
| 1687 | 1686 | }, |
| 1688 | | Code.Id.Obj => |maybe_error_match| { |
| 1687 | .obj => |maybe_error_match| { |
| 1689 | 1688 | const name_plus_obj_ext = try std.fmt.allocPrint(allocator, "{s}{s}", .{ code.name, obj_ext }); |
| 1690 | 1689 | var build_args = std.ArrayList([]const u8).init(allocator); |
| 1691 | 1690 | defer build_args.deinit(); |
| ... | ... | @@ -1758,7 +1757,7 @@ fn genHtml( |
| 1758 | 1757 | } |
| 1759 | 1758 | try shell_out.writeAll("\n"); |
| 1760 | 1759 | }, |
| 1761 | | Code.Id.Lib => { |
| 1760 | .lib => { |
| 1762 | 1761 | const bin_basename = try std.zig.binNameAlloc(allocator, .{ |
| 1763 | 1762 | .root_name = code.name, |
| 1764 | 1763 | .target = builtin.target, |