mirror of
https://github.com/ziglang/zig.git
synced 2024-12-01 01:22:50 +00:00
28 lines
387 B
Zig
28 lines
387 B
Zig
const std = @import("std");
|
|
|
|
var result: []const u8 = "wrong";
|
|
|
|
test "aoeu" {
|
|
start();
|
|
blowUpStack(10);
|
|
|
|
std.debug.assert(std.mem.eql(u8, result, "string literal"));
|
|
}
|
|
|
|
fn start() void {
|
|
foo("string literal");
|
|
}
|
|
|
|
fn foo(x: var) void {
|
|
bar(x);
|
|
}
|
|
|
|
fn bar(x: var) void {
|
|
result = x;
|
|
}
|
|
|
|
fn blowUpStack(x: u32) void {
|
|
if (x == 0) return;
|
|
blowUpStack(x - 1);
|
|
}
|