mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 06:13:07 +00:00
incremental: add new test cases
These cover the fixes from the last few commits.
This commit is contained in:
parent
f01029c4af
commit
6cc848e9f6
74
test/incremental/change_panic_handler
Normal file
74
test/incremental/change_panic_handler
Normal file
@ -0,0 +1,74 @@
|
||||
#target=x86_64-linux-selfhosted
|
||||
#target=x86_64-linux-cbe
|
||||
#target=x86_64-windows-cbe
|
||||
#update=initial version
|
||||
#file=main.zig
|
||||
pub fn main() !u8 {
|
||||
var a: u8 = undefined;
|
||||
a = 255;
|
||||
_ = a + 1;
|
||||
return 1;
|
||||
}
|
||||
pub const Panic = struct {
|
||||
pub const call = myPanic;
|
||||
pub const sentinelMismatch = std.debug.FormattedPanic.sentinelMismatch;
|
||||
pub const unwrapError = std.debug.FormattedPanic.unwrapError;
|
||||
pub const outOfBounds = std.debug.FormattedPanic.outOfBounds;
|
||||
pub const startGreaterThanEnd = std.debug.FormattedPanic.startGreaterThanEnd;
|
||||
pub const inactiveUnionField = std.debug.FormattedPanic.inactiveUnionField;
|
||||
pub const messages = std.debug.FormattedPanic.messages;
|
||||
};
|
||||
fn myPanic(msg: []const u8, _: ?*std.builtin.StackTrace, _: ?usize) noreturn {
|
||||
std.io.getStdOut().writer().print("panic message: {s}\n", .{msg}) catch {};
|
||||
std.process.exit(0);
|
||||
}
|
||||
const std = @import("std");
|
||||
#expect_stdout="panic message: integer overflow\n"
|
||||
|
||||
#update=change the panic handler body
|
||||
#file=main.zig
|
||||
pub fn main() !u8 {
|
||||
var a: u8 = undefined;
|
||||
a = 255;
|
||||
_ = a + 1;
|
||||
return 1;
|
||||
}
|
||||
pub const Panic = struct {
|
||||
pub const call = myPanic;
|
||||
pub const sentinelMismatch = std.debug.FormattedPanic.sentinelMismatch;
|
||||
pub const unwrapError = std.debug.FormattedPanic.unwrapError;
|
||||
pub const outOfBounds = std.debug.FormattedPanic.outOfBounds;
|
||||
pub const startGreaterThanEnd = std.debug.FormattedPanic.startGreaterThanEnd;
|
||||
pub const inactiveUnionField = std.debug.FormattedPanic.inactiveUnionField;
|
||||
pub const messages = std.debug.FormattedPanic.messages;
|
||||
};
|
||||
fn myPanic(msg: []const u8, _: ?*std.builtin.StackTrace, _: ?usize) noreturn {
|
||||
std.io.getStdOut().writer().print("new panic message: {s}\n", .{msg}) catch {};
|
||||
std.process.exit(0);
|
||||
}
|
||||
const std = @import("std");
|
||||
#expect_stdout="new panic message: integer overflow\n"
|
||||
|
||||
#update=change the panic handler function value
|
||||
#file=main.zig
|
||||
pub fn main() !u8 {
|
||||
var a: u8 = undefined;
|
||||
a = 255;
|
||||
_ = a + 1;
|
||||
return 1;
|
||||
}
|
||||
pub const Panic = struct {
|
||||
pub const call = myPanicNew;
|
||||
pub const sentinelMismatch = std.debug.FormattedPanic.sentinelMismatch;
|
||||
pub const unwrapError = std.debug.FormattedPanic.unwrapError;
|
||||
pub const outOfBounds = std.debug.FormattedPanic.outOfBounds;
|
||||
pub const startGreaterThanEnd = std.debug.FormattedPanic.startGreaterThanEnd;
|
||||
pub const inactiveUnionField = std.debug.FormattedPanic.inactiveUnionField;
|
||||
pub const messages = std.debug.FormattedPanic.messages;
|
||||
};
|
||||
fn myPanicNew(msg: []const u8, _: ?*std.builtin.StackTrace, _: ?usize) noreturn {
|
||||
std.io.getStdOut().writer().print("third panic message: {s}\n", .{msg}) catch {};
|
||||
std.process.exit(0);
|
||||
}
|
||||
const std = @import("std");
|
||||
#expect_stdout="third panic message: integer overflow\n"
|
||||
18
test/incremental/temporary_parse_error
Normal file
18
test/incremental/temporary_parse_error
Normal file
@ -0,0 +1,18 @@
|
||||
#target=x86_64-linux-selfhosted
|
||||
#target=x86_64-linux-cbe
|
||||
#target=x86_64-windows-cbe
|
||||
#update=initial version
|
||||
#file=main.zig
|
||||
const std = @import("std");
|
||||
pub fn main() !void {}
|
||||
#expect_stdout=""
|
||||
|
||||
#update=introduce parse error
|
||||
#file=main.zig
|
||||
pub fn main() !void {
|
||||
#expect_error=ignored
|
||||
|
||||
#update=fix parse error
|
||||
#file=main.zig
|
||||
pub fn main() !void {}
|
||||
#expect_stdout=""
|
||||
Loading…
x
Reference in New Issue
Block a user