mirror of
https://github.com/ziglang/zig.git
synced 2026-02-21 16:54:52 +00:00
add building the self hosted compiler to the main test suite
This commit is contained in:
parent
5b156031e9
commit
a45db7e853
@ -33,6 +33,8 @@ pub fn build(b: &Builder) {
|
|||||||
docs_step.dependOn(&docgen_cmd.step);
|
docs_step.dependOn(&docgen_cmd.step);
|
||||||
docs_step.dependOn(&docgen_home_cmd.step);
|
docs_step.dependOn(&docgen_home_cmd.step);
|
||||||
|
|
||||||
|
const test_step = b.step("test", "Run all the tests");
|
||||||
|
|
||||||
if (findLLVM(b)) |llvm| {
|
if (findLLVM(b)) |llvm| {
|
||||||
// find the stage0 build artifacts because we're going to re-use config.h and zig_cpp library
|
// find the stage0 build artifacts because we're going to re-use config.h and zig_cpp library
|
||||||
const build_info = b.exec([][]const u8{b.zig_exe, "BUILD_INFO"});
|
const build_info = b.exec([][]const u8{b.zig_exe, "BUILD_INFO"});
|
||||||
@ -72,15 +74,16 @@ pub fn build(b: &Builder) {
|
|||||||
|
|
||||||
b.default_step.dependOn(&exe.step);
|
b.default_step.dependOn(&exe.step);
|
||||||
b.default_step.dependOn(docs_step);
|
b.default_step.dependOn(docs_step);
|
||||||
|
test_step.dependOn(&exe.step);
|
||||||
|
|
||||||
b.installArtifact(exe);
|
b.installArtifact(exe);
|
||||||
installStdLib(b);
|
installStdLib(b);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const test_filter = b.option([]const u8, "test-filter", "Skip tests that do not match filter");
|
const test_filter = b.option([]const u8, "test-filter", "Skip tests that do not match filter");
|
||||||
const with_lldb = b.option(bool, "with-lldb", "Run tests in LLDB to get a backtrace if one fails") ?? false;
|
const with_lldb = b.option(bool, "with-lldb", "Run tests in LLDB to get a backtrace if one fails") ?? false;
|
||||||
const test_step = b.step("test", "Run all the tests");
|
|
||||||
|
|
||||||
test_step.dependOn(docs_step);
|
test_step.dependOn(docs_step);
|
||||||
|
|
||||||
|
|||||||
@ -626,3 +626,8 @@ fn findZigLibDir(allocator: &mem.Allocator) -> %[]u8 {
|
|||||||
|
|
||||||
return error.FileNotFound;
|
return error.FileNotFound;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
test "import tests" {
|
||||||
|
_ = @import("tokenizer.zig");
|
||||||
|
_ = @import("parser.zig");
|
||||||
|
}
|
||||||
|
|||||||
@ -204,6 +204,7 @@ pub const Tokenizer = struct {
|
|||||||
LineComment,
|
LineComment,
|
||||||
Zero,
|
Zero,
|
||||||
IntegerLiteral,
|
IntegerLiteral,
|
||||||
|
IntegerLiteralWithRadix,
|
||||||
NumberDot,
|
NumberDot,
|
||||||
FloatFraction,
|
FloatFraction,
|
||||||
FloatExponentUnsigned,
|
FloatExponentUnsigned,
|
||||||
@ -454,7 +455,7 @@ pub const Tokenizer = struct {
|
|||||||
},
|
},
|
||||||
State.Zero => switch (c) {
|
State.Zero => switch (c) {
|
||||||
'b', 'o', 'x' => {
|
'b', 'o', 'x' => {
|
||||||
state = State.IntegerLiteral;
|
state = State.IntegerLiteralWithRadix;
|
||||||
},
|
},
|
||||||
else => {
|
else => {
|
||||||
// reinterpret as a normal number
|
// reinterpret as a normal number
|
||||||
@ -469,6 +470,16 @@ pub const Tokenizer = struct {
|
|||||||
'p', 'P', 'e', 'E' => {
|
'p', 'P', 'e', 'E' => {
|
||||||
state = State.FloatExponentUnsigned;
|
state = State.FloatExponentUnsigned;
|
||||||
},
|
},
|
||||||
|
'0'...'9' => {},
|
||||||
|
else => break,
|
||||||
|
},
|
||||||
|
State.IntegerLiteralWithRadix => switch (c) {
|
||||||
|
'.' => {
|
||||||
|
state = State.NumberDot;
|
||||||
|
},
|
||||||
|
'p', 'P' => {
|
||||||
|
state = State.FloatExponentUnsigned;
|
||||||
|
},
|
||||||
'0'...'9', 'a'...'f', 'A'...'F' => {},
|
'0'...'9', 'a'...'f', 'A'...'F' => {},
|
||||||
else => break,
|
else => break,
|
||||||
},
|
},
|
||||||
@ -485,7 +496,7 @@ pub const Tokenizer = struct {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
State.FloatFraction => switch (c) {
|
State.FloatFraction => switch (c) {
|
||||||
'p', 'P', 'e', 'E' => {
|
'p', 'P' => {
|
||||||
state = State.FloatExponentUnsigned;
|
state = State.FloatExponentUnsigned;
|
||||||
},
|
},
|
||||||
'0'...'9', 'a'...'f', 'A'...'F' => {},
|
'0'...'9', 'a'...'f', 'A'...'F' => {},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user