authorgravatar for der.teufel.mail@gmail.comKrzysztof Wolicki <der.teufel.mail@gmail.com> 2023-10-25 21:44:33+02:00
committergravatar for git@vexu.euVeikka Tuominen <git@vexu.eu> 2023-10-26 13:56:43+03:00
loga9e66ed730e17833a3f2701294c01f0b16d206e4
tree6624d2ce517d160cafc208cac406cad6685dab05
parentba817fae8f5f71469ae6ac70fc61b9d3a0e19335

Step.Options: `@typeName` gives a fully qualified name so the test needs to reflect that


1 files changed, 9 insertions(+), 11 deletions(-)

lib/std/Build/Step/Options.zig+9-11
......@@ -106,10 +106,9 @@ fn addOptionFallible(self: *Options, comptime T: type, name: []const u8, value:
106106 try out.print(" {},\n", .{std.zig.fmtId(field.name)});
107107 }
108108 try out.writeAll("};\n");
109 try out.print("pub const {}: {s} = {s}.{s};\n", .{
109 try out.print("pub const {}: {s} = .{s};\n", .{
110110 std.zig.fmtId(name),
111111 std.zig.fmtId(@typeName(T)),
112 std.zig.fmtId(@typeName(T)),
113112 std.zig.fmtId(@tagName(value)),
114113 });
115114 return;
......@@ -322,10 +321,9 @@ test Options {
322321
323322 const options = builder.addOptions();
324323
325 // TODO this regressed at some point
326 //const KeywordEnum = enum {
327 // @"0.8.1",
328 //};
324 const KeywordEnum = enum {
325 @"0.8.1",
326 };
329327
330328 const nested_array = [2][2]u16{
331329 [2]u16{ 300, 200 },
......@@ -341,7 +339,7 @@ test Options {
341339 options.addOption(?[]const u8, "optional_string", null);
342340 options.addOption([2][2]u16, "nested_array", nested_array);
343341 options.addOption([]const []const u16, "nested_slice", nested_slice);
344 //options.addOption(KeywordEnum, "keyword_enum", .@"0.8.1");
342 options.addOption(KeywordEnum, "keyword_enum", .@"0.8.1");
345343 options.addOption(std.SemanticVersion, "semantic_version", try std.SemanticVersion.parse("0.1.2-foo+bar"));
346344
347345 try std.testing.expectEqualStrings(
......@@ -371,10 +369,10 @@ test Options {
371369 \\ 200,
372370 \\ },
373371 \\};
374 //\\pub const KeywordEnum = enum {
375 //\\ @"0.8.1",
376 //\\};
377 //\\pub const keyword_enum: KeywordEnum = KeywordEnum.@"0.8.1";
372 \\pub const @"Build.Step.Options.decltest.Options.KeywordEnum" = enum {
373 \\ @"0.8.1",
374 \\};
375 \\pub const keyword_enum: @"Build.Step.Options.decltest.Options.KeywordEnum" = .@"0.8.1";
378376 \\pub const semantic_version: @import("std").SemanticVersion = .{
379377 \\ .major = 0,
380378 \\ .minor = 1,