zig/test/standalone/run_output_caching/main.zig
mlugg 5c8b92db7f
tests: do not require absolute paths from the build system
File arguments added to `std.Build.Step.Run` with e.g. `addFileArg` are
not necessarily passed as absolute paths. It used to be the case that
they were as a consequence of an unnecessary path conversion done by the
frontend, but this no longer happens, at least not always, so these
tests were sometimes failing when run locally. Therefore, the standalone
tests must handle cwd-relative CLI paths correctly.
2025-06-13 15:46:43 +01:00

10 lines
303 B
Zig

const std = @import("std");
pub fn main() !void {
var args = try std.process.argsWithAllocator(std.heap.page_allocator);
_ = args.skip();
const filename = args.next().?;
const file = try std.fs.cwd().createFile(filename, .{});
defer file.close();
try file.writeAll(filename);
}