zig/test/incremental/recursive_function_becomes_non_recursive
Andrew Kelley debf307594 update all incremental tests to new std API
they're still not passing on windows for some reason though
2025-12-23 22:15:11 -08:00

32 lines
948 B
Text

#target=x86_64-linux-selfhosted
#target=x86_64-windows-selfhosted
#target=x86_64-linux-cbe
#target=x86_64-windows-cbe
#target=wasm32-wasi-selfhosted
#update=initial version
#file=main.zig
pub fn main() !void {
try foo(false);
}
fn foo(recurse: bool) !void {
const stdout = std.Io.File.stdout();
if (recurse) return foo(true);
try stdout.writeStreamingAll(io, "non-recursive path\n");
}
const std = @import("std");
const io = std.Io.Threaded.global_single_threaded.ioBasic();
#expect_stdout="non-recursive path\n"
#update=eliminate recursion and change argument
#file=main.zig
pub fn main() !void {
try foo(true);
}
fn foo(recurse: bool) !void {
const stdout = std.Io.File.stdout();
if (recurse) return stdout.writeStreamingAll(io, "x==1\n");
try stdout.writeStreamingAll(io, "non-recursive path\n");
}
const std = @import("std");
const io = std.Io.Threaded.global_single_threaded.ioBasic();
#expect_stdout="x==1\n"