mirror of
https://github.com/ziglang/zig.git
synced 2026-01-14 11:25:14 +00:00
And fix test cases to make them pass. This is in preparation for starting to pass behavior tests with self-hosted.
28 lines
443 B
Zig
28 lines
443 B
Zig
const std = @import("std");
|
|
|
|
var result: []const u8 = "wrong";
|
|
|
|
test "pass string literal byvalue to a generic var param" {
|
|
start();
|
|
blowUpStack(10);
|
|
|
|
std.testing.expect(std.mem.eql(u8, result, "string literal"));
|
|
}
|
|
|
|
fn start() void {
|
|
foo("string literal");
|
|
}
|
|
|
|
fn foo(x: anytype) void {
|
|
bar(x);
|
|
}
|
|
|
|
fn bar(x: anytype) void {
|
|
result = x;
|
|
}
|
|
|
|
fn blowUpStack(x: u32) void {
|
|
if (x == 0) return;
|
|
blowUpStack(x - 1);
|
|
}
|