Commit a9e66ed730

Krzysztof Wolicki <der.teufel.mail@gmail.com>
2023-10-25 21:44:33
Step.Options: `@typeName` gives a fully qualified name so the test needs to reflect that
1 parent ba817fa
Changed files (1)
lib
std
Build
lib/std/Build/Step/Options.zig
@@ -106,10 +106,9 @@ fn addOptionFallible(self: *Options, comptime T: type, name: []const u8, value:
                 try out.print("    {},\n", .{std.zig.fmtId(field.name)});
             }
             try out.writeAll("};\n");
-            try out.print("pub const {}: {s} = {s}.{s};\n", .{
+            try out.print("pub const {}: {s} = .{s};\n", .{
                 std.zig.fmtId(name),
                 std.zig.fmtId(@typeName(T)),
-                std.zig.fmtId(@typeName(T)),
                 std.zig.fmtId(@tagName(value)),
             });
             return;
@@ -322,10 +321,9 @@ test Options {
 
     const options = builder.addOptions();
 
-    // TODO this regressed at some point
-    //const KeywordEnum = enum {
-    //    @"0.8.1",
-    //};
+    const KeywordEnum = enum {
+        @"0.8.1",
+    };
 
     const nested_array = [2][2]u16{
         [2]u16{ 300, 200 },
@@ -341,7 +339,7 @@ test Options {
     options.addOption(?[]const u8, "optional_string", null);
     options.addOption([2][2]u16, "nested_array", nested_array);
     options.addOption([]const []const u16, "nested_slice", nested_slice);
-    //options.addOption(KeywordEnum, "keyword_enum", .@"0.8.1");
+    options.addOption(KeywordEnum, "keyword_enum", .@"0.8.1");
     options.addOption(std.SemanticVersion, "semantic_version", try std.SemanticVersion.parse("0.1.2-foo+bar"));
 
     try std.testing.expectEqualStrings(
@@ -371,10 +369,10 @@ test Options {
         \\        200,
         \\    },
         \\};
-        //\\pub const KeywordEnum = enum {
-        //\\    @"0.8.1",
-        //\\};
-        //\\pub const keyword_enum: KeywordEnum = KeywordEnum.@"0.8.1";
+        \\pub const @"Build.Step.Options.decltest.Options.KeywordEnum" = enum {
+        \\    @"0.8.1",
+        \\};
+        \\pub const keyword_enum: @"Build.Step.Options.decltest.Options.KeywordEnum" = .@"0.8.1";
         \\pub const semantic_version: @import("std").SemanticVersion = .{
         \\    .major = 0,
         \\    .minor = 1,