zig/test/incremental/change_struct_same_fields
mlugg ca12e4f33e
test: remove old-style incremental cases, add a few new incremental cases
These cases have been disabled for a while, and we have transitioned to
using a compact file format for incremental test cases.

I was originally planning to port all of these cases, but the vast
majority aren't testing anything interesting, so it wasn't worth the
effort. I did look through each one; anything interesting being tested
has been extracted into a new case in `test/incremental/`.

Two of the new tests are currently failing with the self-hosted ELF
linker, and thus are currently only enabled with the C backend.

Resolves: #12844
2024-11-11 12:22:48 +00:00

51 lines
1.1 KiB
Plaintext

#target=x86_64-linux-selfhosted
#target=x86_64-linux-cbe
#target=x86_64-windows-cbe
#update=initial version
#file=main.zig
const S = extern struct { x: u8, y: u8 };
pub fn main() !void {
const val: S = .{ .x = 100, .y = 200 };
try foo(&val);
}
fn foo(val: *const S) !void {
try std.io.getStdOut().writer().print(
"{d} {d}\n",
.{ val.x, val.y },
);
}
const std = @import("std");
#expect_stdout="100 200\n"
#update=change struct layout
#file=main.zig
const S = extern struct { x: u32, y: u32 };
pub fn main() !void {
const val: S = .{ .x = 100, .y = 200 };
try foo(&val);
}
fn foo(val: *const S) !void {
try std.io.getStdOut().writer().print(
"{d} {d}\n",
.{ val.x, val.y },
);
}
const std = @import("std");
#expect_stdout="100 200\n"
#update=change values
#file=main.zig
const S = extern struct { x: u32, y: u32 };
pub fn main() !void {
const val: S = .{ .x = 1234, .y = 5678 };
try foo(&val);
}
fn foo(val: *const S) !void {
try std.io.getStdOut().writer().print(
"{d} {d}\n",
.{ val.x, val.y },
);
}
const std = @import("std");
#expect_stdout="1234 5678\n"