From a9e66ed730e17833a3f2701294c01f0b16d206e4 Mon Sep 17 00:00:00 2001 From: Krzysztof Wolicki Date: Wed, 25 Oct 2023 21:44:33 +0200 Subject: [PATCH] Step.Options: `@typeName` gives a fully qualified name so the test needs to reflect that --- lib/std/Build/Step/Options.zig | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/lib/std/Build/Step/Options.zig b/lib/std/Build/Step/Options.zig index d3a7ab3c72..669803b627 100644 --- a/lib/std/Build/Step/Options.zig +++ b/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,