mirror of
https://github.com/ziglang/zig.git
synced 2026-02-14 21:38:33 +00:00
std.build.OptionsStep: fix regressed tests
This commit is contained in:
parent
dd547f06c6
commit
d1ad126e34
@ -131,7 +131,7 @@ pub fn addOption(self: *OptionsStep, comptime T: type, name: []const u8, value:
|
||||
},
|
||||
else => {},
|
||||
}
|
||||
out.print("pub const {}: {s} = ", .{ std.zig.fmtId(name), std.zig.fmtId(@typeName(T)) }) catch unreachable;
|
||||
out.print("pub const {}: {s} = ", .{ std.zig.fmtId(name), @typeName(T) }) catch unreachable;
|
||||
printLiteral(out, value, 0) catch unreachable;
|
||||
out.writeAll(";\n") catch unreachable;
|
||||
}
|
||||
@ -292,9 +292,10 @@ test "OptionsStep" {
|
||||
|
||||
const options = builder.addOptions();
|
||||
|
||||
const KeywordEnum = enum {
|
||||
@"0.8.1",
|
||||
};
|
||||
// TODO this regressed at some point
|
||||
//const KeywordEnum = enum {
|
||||
// @"0.8.1",
|
||||
//};
|
||||
|
||||
const nested_array = [2][2]u16{
|
||||
[2]u16{ 300, 200 },
|
||||
@ -310,7 +311,7 @@ test "OptionsStep" {
|
||||
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.builtin.Version, "version", try std.builtin.Version.parse("0.1.2"));
|
||||
options.addOption(std.SemanticVersion, "semantic_version", try std.SemanticVersion.parse("0.1.2-foo+bar"));
|
||||
|
||||
@ -341,10 +342,10 @@ test "OptionsStep" {
|
||||
\\ 200,
|
||||
\\ },
|
||||
\\};
|
||||
\\pub const KeywordEnum = enum {
|
||||
\\ @"0.8.1",
|
||||
\\};
|
||||
\\pub const keyword_enum: KeywordEnum = KeywordEnum.@"0.8.1";
|
||||
//\\pub const KeywordEnum = enum {
|
||||
//\\ @"0.8.1",
|
||||
//\\};
|
||||
//\\pub const keyword_enum: KeywordEnum = KeywordEnum.@"0.8.1";
|
||||
\\pub const version: @import("std").builtin.Version = .{
|
||||
\\ .major = 0,
|
||||
\\ .minor = 1,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user