diff options
| author | mlugg <mlugg@mlugg.co.uk> | 2024-11-11 12:05:38 +0000 |
|---|---|---|
| committer | mlugg <mlugg@mlugg.co.uk> | 2024-11-11 12:22:48 +0000 |
| commit | ca12e4f33e9030e5e724aae2f6dda9f2d87dccf6 (patch) | |
| tree | e50211d40d249c16c231d0f4331a815b1a42b056 /test/incremental/recursive_function_becomes_non_recursive | |
| parent | 560d6b99d5be8e906b7d8d70a2b2e1f1d4da4f89 (diff) | |
| download | zig-ca12e4f33e9030e5e724aae2f6dda9f2d87dccf6.tar.gz zig-ca12e4f33e9030e5e724aae2f6dda9f2d87dccf6.zip | |
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
Diffstat (limited to 'test/incremental/recursive_function_becomes_non_recursive')
| -rw-r--r-- | test/incremental/recursive_function_becomes_non_recursive | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/incremental/recursive_function_becomes_non_recursive b/test/incremental/recursive_function_becomes_non_recursive new file mode 100644 index 0000000000..7a9eb5d26f --- /dev/null +++ b/test/incremental/recursive_function_becomes_non_recursive @@ -0,0 +1,28 @@ +//#target=x86_64-linux-selfhosted +#target=x86_64-linux-cbe +#target=x86_64-windows-cbe +#update=initial version +#file=main.zig +pub fn main() !void { + try foo(false); +} +fn foo(recurse: bool) !void { + const stdout = std.io.getStdOut().writer(); + if (recurse) return foo(true); + try stdout.writeAll("non-recursive path\n"); +} +const std = @import("std"); +#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.getStdOut().writer(); + if (recurse) return stdout.writeAll("x==1\n"); + try stdout.writeAll("non-recursive path\n"); +} +const std = @import("std"); +#expect_stdout="x==1\n" |
