diff --git a/test/cases/aarch64-linux/conditional_branches.0.zig b/test/cases/aarch64-linux/conditional_branches.0.zig deleted file mode 100644 index 28435b9d4a..0000000000 --- a/test/cases/aarch64-linux/conditional_branches.0.zig +++ /dev/null @@ -1,26 +0,0 @@ -pub fn main() void { - foo(123); -} - -fn foo(x: u64) void { - if (x > 42) { - print(); - } -} - -fn print() void { - asm volatile ("svc #0" - : - : [number] "{x8}" (64), - [arg1] "{x0}" (1), - [arg2] "{x1}" (@ptrToInt("Hello, World!\n")), - [arg3] "{x2}" ("Hello, World!\n".len), - : "memory", "cc" - ); -} - -// run -// target=aarch64-linux -// -// Hello, World! -// diff --git a/test/cases/aarch64-linux/conditional_branches.1.zig b/test/cases/aarch64-linux/conditional_branches.1.zig deleted file mode 100644 index e03758fcb7..0000000000 --- a/test/cases/aarch64-linux/conditional_branches.1.zig +++ /dev/null @@ -1,25 +0,0 @@ -pub fn main() void { - foo(true); -} - -fn foo(x: bool) void { - if (x) { - print(); - } -} - -fn print() void { - asm volatile ("svc #0" - : - : [number] "{x8}" (64), - [arg1] "{x0}" (1), - [arg2] "{x1}" (@ptrToInt("Hello, World!\n")), - [arg3] "{x2}" ("Hello, World!\n".len), - : "memory", "cc" - ); -} - -// run -// -// Hello, World! -// diff --git a/test/cases/aarch64-linux/hello_world_with_updates.0.zig b/test/cases/aarch64-linux/hello_world_with_updates.0.zig deleted file mode 100644 index 7a87d74dc3..0000000000 --- a/test/cases/aarch64-linux/hello_world_with_updates.0.zig +++ /dev/null @@ -1,31 +0,0 @@ -pub export fn _start() noreturn { - print(); - exit(0); -} - -fn print() void { - asm volatile ("svc #0" - : - : [number] "{x8}" (64), - [arg1] "{x0}" (1), - [arg2] "{x1}" (@ptrToInt("Hello, World!\n")), - [arg3] "{x2}" ("Hello, World!\n".len), - : "memory", "cc" - ); -} - -fn exit(ret: usize) noreturn { - asm volatile ("svc #0" - : - : [number] "{x8}" (93), - [arg1] "{x0}" (ret), - : "memory", "cc" - ); - unreachable; -} - -// run -// target=aarch64-linux -// -// Hello, World! -// diff --git a/test/cases/aarch64-linux/hello_world_with_updates.1.zig b/test/cases/aarch64-linux/hello_world_with_updates.1.zig deleted file mode 100644 index a5ca0d9926..0000000000 --- a/test/cases/aarch64-linux/hello_world_with_updates.1.zig +++ /dev/null @@ -1,36 +0,0 @@ -pub export fn _start() noreturn { - print(); - print(); - print(); - print(); - exit(0); -} - -fn print() void { - asm volatile ("svc #0" - : - : [number] "{x8}" (64), - [arg1] "{x0}" (1), - [arg2] "{x1}" (@ptrToInt("Hello, World!\n")), - [arg3] "{x2}" ("Hello, World!\n".len), - : "memory", "cc" - ); -} - -fn exit(ret: usize) noreturn { - asm volatile ("svc #0" - : - : [number] "{x8}" (93), - [arg1] "{x0}" (ret), - : "memory", "cc" - ); - unreachable; -} - -// run -// -// Hello, World! -// Hello, World! -// Hello, World! -// Hello, World! -// diff --git a/test/cases/aarch64-linux/hello_world_with_updates.2.zig b/test/cases/aarch64-linux/hello_world_with_updates.2.zig deleted file mode 100644 index 71f0f160bc..0000000000 --- a/test/cases/aarch64-linux/hello_world_with_updates.2.zig +++ /dev/null @@ -1,21 +0,0 @@ -pub fn main() void { - print(); - print(); -} - -fn print() void { - asm volatile ("svc #0" - : - : [number] "{x8}" (64), - [arg1] "{x0}" (1), - [arg2] "{x1}" (@ptrToInt("Hello, World!\n")), - [arg3] "{x2}" ("Hello, World!\n".len), - : "memory", "cc" - ); -} - -// run -// -// Hello, World! -// Hello, World! -// diff --git a/test/cases/aarch64-macos/hello_world_with_updates.4.zig b/test/cases/aarch64-macos/hello_world_with_updates.4.zig deleted file mode 100644 index f89cef7354..0000000000 --- a/test/cases/aarch64-macos/hello_world_with_updates.4.zig +++ /dev/null @@ -1,22 +0,0 @@ -extern "c" fn write(usize, usize, usize) usize; - -pub fn main() void { - print(); - print(); - print(); - print(); -} - -fn print() void { - const msg = @ptrToInt("Hello, World!\n"); - const len = 14; - _ = write(1, msg, len); -} - -// run -// -// Hello, World! -// Hello, World! -// Hello, World! -// Hello, World! -// diff --git a/test/cases/aarch64-macos/hello_world_with_updates.5.zig b/test/cases/aarch64-macos/hello_world_with_updates.5.zig deleted file mode 100644 index 0d7f97578a..0000000000 --- a/test/cases/aarch64-macos/hello_world_with_updates.5.zig +++ /dev/null @@ -1,16 +0,0 @@ -extern "c" fn write(usize, usize, usize) usize; - -pub fn main() void { - print(); -} - -fn print() void { - const msg = @ptrToInt("What is up? This is a longer message that will force the data to be relocated in virtual address space.\n"); - const len = 104; - _ = write(1, msg, len); -} - -// run -// -// What is up? This is a longer message that will force the data to be relocated in virtual address space. -// diff --git a/test/cases/aarch64-macos/hello_world_with_updates.6.zig b/test/cases/aarch64-macos/hello_world_with_updates.6.zig deleted file mode 100644 index 3ce2cb7176..0000000000 --- a/test/cases/aarch64-macos/hello_world_with_updates.6.zig +++ /dev/null @@ -1,18 +0,0 @@ -extern "c" fn write(usize, usize, usize) usize; - -pub fn main() void { - print(); - print(); -} - -fn print() void { - const msg = @ptrToInt("What is up? This is a longer message that will force the data to be relocated in virtual address space.\n"); - const len = 104; - _ = write(1, msg, len); -} - -// run -// -// What is up? This is a longer message that will force the data to be relocated in virtual address space. -// What is up? This is a longer message that will force the data to be relocated in virtual address space. -// diff --git a/test/cases/arithmetic_operations.0.zig b/test/cases/arithmetic_operations.0.zig new file mode 100644 index 0000000000..405c19d86a --- /dev/null +++ b/test/cases/arithmetic_operations.0.zig @@ -0,0 +1,17 @@ +const std = @import("std"); + +pub fn main() void { + print(2, 4); + print(1, 7); +} + +fn print(a: u32, b: u32) void { + const str = "123456789"; + const len = a + b; + _ = std.os.write(1, str[0..len]) catch {}; +} + +// run +// target=x86_64-linux,x86_64-macos +// +// 12345612345678 diff --git a/test/cases/arithmetic_operations.1.zig b/test/cases/arithmetic_operations.1.zig new file mode 100644 index 0000000000..ba2520abe9 --- /dev/null +++ b/test/cases/arithmetic_operations.1.zig @@ -0,0 +1,16 @@ +const std = @import("std"); + +pub fn main() void { + print(10, 5); + print(4, 3); +} + +fn print(a: u32, b: u32) void { + const str = "123456789"; + const len = a - b; + _ = std.os.write(1, str[0..len]) catch {}; +} + +// run +// +// 123451 diff --git a/test/cases/arithmetic_operations.2.zig b/test/cases/arithmetic_operations.2.zig new file mode 100644 index 0000000000..be4ec466f1 --- /dev/null +++ b/test/cases/arithmetic_operations.2.zig @@ -0,0 +1,16 @@ +const std = @import("std"); + +pub fn main() void { + print(8, 9); + print(3, 7); +} + +fn print(a: u32, b: u32) void { + const str = "123456789"; + const len = a & b; + _ = std.os.write(1, str[0..len]) catch {}; +} + +// run +// +// 12345678123 diff --git a/test/cases/arithmetic_operations.3.zig b/test/cases/arithmetic_operations.3.zig new file mode 100644 index 0000000000..b939950730 --- /dev/null +++ b/test/cases/arithmetic_operations.3.zig @@ -0,0 +1,16 @@ +const std = @import("std"); + +pub fn main() void { + print(4, 2); + print(3, 7); +} + +fn print(a: u32, b: u32) void { + const str = "123456789"; + const len = a | b; + _ = std.os.write(1, str[0..len]) catch {}; +} + +// run +// +// 1234561234567 diff --git a/test/cases/arithmetic_operations.4.zig b/test/cases/arithmetic_operations.4.zig new file mode 100644 index 0000000000..50bf0df0ce --- /dev/null +++ b/test/cases/arithmetic_operations.4.zig @@ -0,0 +1,16 @@ +const std = @import("std"); + +pub fn main() void { + print(42, 42); + print(3, 5); +} + +fn print(a: u32, b: u32) void { + const str = "123456789"; + const len = a ^ b; + _ = std.os.write(1, str[0..len]) catch {}; +} + +// run +// +// 123456 diff --git a/test/cases/arm-linux/arithmetic_operations.5.zig b/test/cases/arithmetic_operations.5.zig similarity index 100% rename from test/cases/arm-linux/arithmetic_operations.5.zig rename to test/cases/arithmetic_operations.5.zig diff --git a/test/cases/arm-linux/arithmetic_operations.6.zig b/test/cases/arithmetic_operations.6.zig similarity index 100% rename from test/cases/arm-linux/arithmetic_operations.6.zig rename to test/cases/arithmetic_operations.6.zig diff --git a/test/cases/arm-linux/arithmetic_operations.0.zig b/test/cases/arm-linux/arithmetic_operations.0.zig deleted file mode 100644 index 51a2dbd700..0000000000 --- a/test/cases/arm-linux/arithmetic_operations.0.zig +++ /dev/null @@ -1,21 +0,0 @@ -pub fn main() void { - print(2, 4); - print(1, 7); -} - -fn print(a: u32, b: u32) void { - asm volatile ("svc #0" - : - : [number] "{r7}" (4), - [arg3] "{r2}" (a + b), - [arg1] "{r0}" (1), - [arg2] "{r1}" (@ptrToInt("123456789")), - : "memory" - ); - return; -} - -// run -// target=arm-linux -// -// 12345612345678 diff --git a/test/cases/arm-linux/arithmetic_operations.1.zig b/test/cases/arm-linux/arithmetic_operations.1.zig deleted file mode 100644 index 1e3793ed38..0000000000 --- a/test/cases/arm-linux/arithmetic_operations.1.zig +++ /dev/null @@ -1,20 +0,0 @@ -pub fn main() void { - print(10, 5); - print(4, 3); -} - -fn print(a: u32, b: u32) void { - asm volatile ("svc #0" - : - : [number] "{r7}" (4), - [arg3] "{r2}" (a - b), - [arg1] "{r0}" (1), - [arg2] "{r1}" (@ptrToInt("123456789")), - : "memory" - ); - return; -} - -// run -// -// 123451 diff --git a/test/cases/arm-linux/arithmetic_operations.2.zig b/test/cases/arm-linux/arithmetic_operations.2.zig deleted file mode 100644 index 6b81e62198..0000000000 --- a/test/cases/arm-linux/arithmetic_operations.2.zig +++ /dev/null @@ -1,20 +0,0 @@ -pub fn main() void { - print(8, 9); - print(3, 7); -} - -fn print(a: u32, b: u32) void { - asm volatile ("svc #0" - : - : [number] "{r7}" (4), - [arg3] "{r2}" (a & b), - [arg1] "{r0}" (1), - [arg2] "{r1}" (@ptrToInt("123456789")), - : "memory" - ); - return; -} - -// run -// -// 12345678123 diff --git a/test/cases/arm-linux/arithmetic_operations.3.zig b/test/cases/arm-linux/arithmetic_operations.3.zig deleted file mode 100644 index 23089127f5..0000000000 --- a/test/cases/arm-linux/arithmetic_operations.3.zig +++ /dev/null @@ -1,20 +0,0 @@ -pub fn main() void { - print(4, 2); - print(3, 7); -} - -fn print(a: u32, b: u32) void { - asm volatile ("svc #0" - : - : [number] "{r7}" (4), - [arg3] "{r2}" (a | b), - [arg1] "{r0}" (1), - [arg2] "{r1}" (@ptrToInt("123456789")), - : "memory" - ); - return; -} - -// run -// -// 1234561234567 diff --git a/test/cases/arm-linux/arithmetic_operations.4.zig b/test/cases/arm-linux/arithmetic_operations.4.zig deleted file mode 100644 index ce5133c465..0000000000 --- a/test/cases/arm-linux/arithmetic_operations.4.zig +++ /dev/null @@ -1,20 +0,0 @@ -pub fn main() void { - print(42, 42); - print(3, 5); -} - -fn print(a: u32, b: u32) void { - asm volatile ("svc #0" - : - : [number] "{r7}" (4), - [arg3] "{r2}" (a ^ b), - [arg1] "{r0}" (1), - [arg2] "{r1}" (@ptrToInt("123456789")), - : "memory" - ); - return; -} - -// run -// -// 123456 diff --git a/test/cases/arm-linux/errors.0.zig b/test/cases/arm-linux/errors.0.zig deleted file mode 100644 index 3e20d1d973..0000000000 --- a/test/cases/arm-linux/errors.0.zig +++ /dev/null @@ -1,21 +0,0 @@ -pub fn main() void { - foo() catch print(); -} - -fn foo() anyerror!void {} - -fn print() void { - asm volatile ("svc #0" - : - : [number] "{r7}" (4), - [arg1] "{r0}" (1), - [arg2] "{r1}" (@ptrToInt("Hello, World!\n")), - [arg3] "{r2}" ("Hello, World!\n".len), - : "memory" - ); - return; -} - -// run -// target=arm-linux -// diff --git a/test/cases/arm-linux/errors.1.zig b/test/cases/arm-linux/errors.1.zig deleted file mode 100644 index 43fbb12675..0000000000 --- a/test/cases/arm-linux/errors.1.zig +++ /dev/null @@ -1,24 +0,0 @@ -pub fn main() void { - foo() catch print(); -} - -fn foo() anyerror!void { - return error.Test; -} - -fn print() void { - asm volatile ("svc #0" - : - : [number] "{r7}" (4), - [arg1] "{r0}" (1), - [arg2] "{r1}" (@ptrToInt("Hello, World!\n")), - [arg3] "{r2}" ("Hello, World!\n".len), - : "memory" - ); - return; -} - -// run -// -// Hello, World! -// diff --git a/test/cases/arm-linux/function_pointers.zig b/test/cases/arm-linux/function_pointers.zig deleted file mode 100644 index 0ef5df6745..0000000000 --- a/test/cases/arm-linux/function_pointers.zig +++ /dev/null @@ -1,44 +0,0 @@ -const PrintFn = *const fn () void; - -pub fn main() void { - var printFn: PrintFn = stopSayingThat; - var i: u32 = 0; - while (i < 4) : (i += 1) printFn(); - - printFn = moveEveryZig; - printFn(); -} - -fn stopSayingThat() void { - asm volatile ("svc #0" - : - : [number] "{r7}" (4), - [arg1] "{r0}" (1), - [arg2] "{r1}" (@ptrToInt("Hello, my name is Inigo Montoya; you killed my father, prepare to die.\n")), - [arg3] "{r2}" ("Hello, my name is Inigo Montoya; you killed my father, prepare to die.\n".len), - : "memory" - ); - return; -} - -fn moveEveryZig() void { - asm volatile ("svc #0" - : - : [number] "{r7}" (4), - [arg1] "{r0}" (1), - [arg2] "{r1}" (@ptrToInt("All your codebase are belong to us\n")), - [arg3] "{r2}" ("All your codebase are belong to us\n".len), - : "memory" - ); - return; -} - -// run -// target=arm-linux -// -// Hello, my name is Inigo Montoya; you killed my father, prepare to die. -// Hello, my name is Inigo Montoya; you killed my father, prepare to die. -// Hello, my name is Inigo Montoya; you killed my father, prepare to die. -// Hello, my name is Inigo Montoya; you killed my father, prepare to die. -// All your codebase are belong to us -// diff --git a/test/cases/arm-linux/hello_world_with_updates.0.zig b/test/cases/arm-linux/hello_world_with_updates.0.zig deleted file mode 100644 index 4ffdc2ae0f..0000000000 --- a/test/cases/arm-linux/hello_world_with_updates.0.zig +++ /dev/null @@ -1,32 +0,0 @@ -pub export fn _start() noreturn { - print(); - exit(); -} - -fn print() void { - asm volatile ("svc #0" - : - : [number] "{r7}" (4), - [arg1] "{r0}" (1), - [arg2] "{r1}" (@ptrToInt("Hello, World!\n")), - [arg3] "{r2}" (14), - : "memory" - ); - return; -} - -fn exit() noreturn { - asm volatile ("svc #0" - : - : [number] "{r7}" (1), - [arg1] "{r0}" (0), - : "memory" - ); - unreachable; -} - -// run -// target=arm-linux -// -// Hello, World! -// diff --git a/test/cases/arm-linux/hello_world_with_updates.1.zig b/test/cases/arm-linux/hello_world_with_updates.1.zig deleted file mode 100644 index 8372d757ad..0000000000 --- a/test/cases/arm-linux/hello_world_with_updates.1.zig +++ /dev/null @@ -1,37 +0,0 @@ -pub export fn _start() noreturn { - print(); - print(); - print(); - print(); - exit(); -} - -fn print() void { - asm volatile ("svc #0" - : - : [number] "{r7}" (4), - [arg1] "{r0}" (1), - [arg2] "{r1}" (@ptrToInt("Hello, World!\n")), - [arg3] "{r2}" (14), - : "memory" - ); - return; -} - -fn exit() noreturn { - asm volatile ("svc #0" - : - : [number] "{r7}" (1), - [arg1] "{r0}" (0), - : "memory" - ); - unreachable; -} - -// run -// -// Hello, World! -// Hello, World! -// Hello, World! -// Hello, World! -// diff --git a/test/cases/arm-linux/hello_world_with_updates.2.zig b/test/cases/arm-linux/hello_world_with_updates.2.zig deleted file mode 100644 index 0b97bf2360..0000000000 --- a/test/cases/arm-linux/hello_world_with_updates.2.zig +++ /dev/null @@ -1,22 +0,0 @@ -pub fn main() void { - print(); - print(); -} - -fn print() void { - asm volatile ("svc #0" - : - : [number] "{r7}" (4), - [arg1] "{r0}" (1), - [arg2] "{r1}" (@ptrToInt("Hello, World!\n")), - [arg3] "{r2}" (14), - : "memory" - ); - return; -} - -// run -// -// Hello, World! -// Hello, World! -// diff --git a/test/cases/arm-linux/parameters_and_return_values.0.zig b/test/cases/arm-linux/parameters_and_return_values.0.zig deleted file mode 100644 index 6a306d802c..0000000000 --- a/test/cases/arm-linux/parameters_and_return_values.0.zig +++ /dev/null @@ -1,28 +0,0 @@ -pub fn main() void { - print(id(14)); -} - -fn id(x: u32) u32 { - return x; -} - -// TODO: The parameters to the asm statement in print() had to -// be in a specific order because otherwise the write to r0 -// would overwrite the len parameter which resides in r0 -fn print(len: u32) void { - asm volatile ("svc #0" - : - : [number] "{r7}" (4), - [arg3] "{r2}" (len), - [arg1] "{r0}" (1), - [arg2] "{r1}" (@ptrToInt("Hello, World!\n")), - : "memory" - ); - return; -} - -// run -// target=arm-linux -// -// Hello, World! -// diff --git a/test/cases/arm-linux/print_u32s.zig b/test/cases/arm-linux/print_u32s.zig deleted file mode 100644 index 92fad75ddf..0000000000 --- a/test/cases/arm-linux/print_u32s.zig +++ /dev/null @@ -1,40 +0,0 @@ -pub fn main() void { - printNumberHex(0x00000000); - printNumberHex(0xaaaaaaaa); - printNumberHex(0xdeadbeef); - printNumberHex(0x31415926); -} - -fn printNumberHex(x: u32) void { - var i: u5 = 28; - while (true) : (i -= 4) { - const digit = (x >> i) & 0xf; - asm volatile ("svc #0" - : - : [number] "{r7}" (4), - [arg1] "{r0}" (1), - [arg2] "{r1}" (@ptrToInt("0123456789abcdef") + digit), - [arg3] "{r2}" (1), - : "memory" - ); - - if (i == 0) break; - } - asm volatile ("svc #0" - : - : [number] "{r7}" (4), - [arg1] "{r0}" (1), - [arg2] "{r1}" (@ptrToInt("\n")), - [arg3] "{r2}" (1), - : "memory" - ); -} - -// run -// target=arm-linux -// -// 00000000 -// aaaaaaaa -// deadbeef -// 31415926 -// diff --git a/test/cases/x86_64-linux/assert_function.0.zig b/test/cases/assert_function.0.zig similarity index 77% rename from test/cases/x86_64-linux/assert_function.0.zig rename to test/cases/assert_function.0.zig index ab34f5328d..7a832e522b 100644 --- a/test/cases/x86_64-linux/assert_function.0.zig +++ b/test/cases/assert_function.0.zig @@ -11,5 +11,5 @@ pub fn assert(ok: bool) void { } // run -// target=x86_64-linux -// +// target=x86_64-macos,x86_64-linux +// link_libc=true diff --git a/test/cases/x86_64-linux/assert_function.1.zig b/test/cases/assert_function.1.zig similarity index 100% rename from test/cases/x86_64-linux/assert_function.1.zig rename to test/cases/assert_function.1.zig diff --git a/test/cases/x86_64-linux/assert_function.10.zig b/test/cases/assert_function.10.zig similarity index 100% rename from test/cases/x86_64-linux/assert_function.10.zig rename to test/cases/assert_function.10.zig diff --git a/test/cases/x86_64-linux/assert_function.11.zig b/test/cases/assert_function.11.zig similarity index 100% rename from test/cases/x86_64-linux/assert_function.11.zig rename to test/cases/assert_function.11.zig diff --git a/test/cases/x86_64-linux/assert_function.12.zig b/test/cases/assert_function.12.zig similarity index 100% rename from test/cases/x86_64-linux/assert_function.12.zig rename to test/cases/assert_function.12.zig diff --git a/test/cases/x86_64-linux/assert_function.13.zig b/test/cases/assert_function.13.zig similarity index 100% rename from test/cases/x86_64-linux/assert_function.13.zig rename to test/cases/assert_function.13.zig diff --git a/test/cases/x86_64-linux/assert_function.14.zig b/test/cases/assert_function.14.zig similarity index 100% rename from test/cases/x86_64-linux/assert_function.14.zig rename to test/cases/assert_function.14.zig diff --git a/test/cases/x86_64-linux/assert_function.15.zig b/test/cases/assert_function.15.zig similarity index 100% rename from test/cases/x86_64-linux/assert_function.15.zig rename to test/cases/assert_function.15.zig diff --git a/test/cases/x86_64-linux/assert_function.16.zig b/test/cases/assert_function.16.zig similarity index 100% rename from test/cases/x86_64-linux/assert_function.16.zig rename to test/cases/assert_function.16.zig diff --git a/test/cases/x86_64-linux/assert_function.17.zig b/test/cases/assert_function.17.zig similarity index 100% rename from test/cases/x86_64-linux/assert_function.17.zig rename to test/cases/assert_function.17.zig diff --git a/test/cases/assert_function.18.zig b/test/cases/assert_function.18.zig new file mode 100644 index 0000000000..5f05e4ae70 --- /dev/null +++ b/test/cases/assert_function.18.zig @@ -0,0 +1,20 @@ +const builtin = @import("builtin"); + +extern "c" fn write(c_int, usize, usize) usize; + +pub fn main() void { + for ("hello") |_| print(); +} + +fn print() void { + _ = write(1, @ptrToInt("hello\n"), 6); +} + +// run +// +// hello +// hello +// hello +// hello +// hello +// diff --git a/test/cases/x86_64-linux/assert_function.2.zig b/test/cases/assert_function.2.zig similarity index 100% rename from test/cases/x86_64-linux/assert_function.2.zig rename to test/cases/assert_function.2.zig diff --git a/test/cases/x86_64-linux/assert_function.3.zig b/test/cases/assert_function.3.zig similarity index 100% rename from test/cases/x86_64-linux/assert_function.3.zig rename to test/cases/assert_function.3.zig diff --git a/test/cases/x86_64-linux/assert_function.4.zig b/test/cases/assert_function.4.zig similarity index 100% rename from test/cases/x86_64-linux/assert_function.4.zig rename to test/cases/assert_function.4.zig diff --git a/test/cases/x86_64-linux/assert_function.5.zig b/test/cases/assert_function.5.zig similarity index 100% rename from test/cases/x86_64-linux/assert_function.5.zig rename to test/cases/assert_function.5.zig diff --git a/test/cases/x86_64-linux/assert_function.6.zig b/test/cases/assert_function.6.zig similarity index 100% rename from test/cases/x86_64-linux/assert_function.6.zig rename to test/cases/assert_function.6.zig diff --git a/test/cases/x86_64-macos/assert_function.7.zig b/test/cases/assert_function.7.zig similarity index 86% rename from test/cases/x86_64-macos/assert_function.7.zig rename to test/cases/assert_function.7.zig index 27ba37029a..0004435db6 100644 --- a/test/cases/x86_64-macos/assert_function.7.zig +++ b/test/cases/assert_function.7.zig @@ -1,4 +1,4 @@ -extern "c" fn write(usize, usize, usize) usize; +extern "c" fn write(c_int, usize, usize) usize; pub fn main() void { var i: u32 = 0; diff --git a/test/cases/x86_64-macos/assert_function.8.zig b/test/cases/assert_function.8.zig similarity index 88% rename from test/cases/x86_64-macos/assert_function.8.zig rename to test/cases/assert_function.8.zig index 3942a3e24b..3e8e247dac 100644 --- a/test/cases/x86_64-macos/assert_function.8.zig +++ b/test/cases/assert_function.8.zig @@ -1,4 +1,4 @@ -extern "c" fn write(usize, usize, usize) usize; +extern "c" fn write(c_int, usize, usize) usize; pub fn main() void { var i: u32 = 0; diff --git a/test/cases/x86_64-linux/assert_function.9.zig b/test/cases/assert_function.9.zig similarity index 100% rename from test/cases/x86_64-linux/assert_function.9.zig rename to test/cases/assert_function.9.zig diff --git a/test/cases/break_continue.0.zig b/test/cases/break_continue.0.zig index ac0abdb52d..6684bcb0d0 100644 --- a/test/cases/break_continue.0.zig +++ b/test/cases/break_continue.0.zig @@ -5,5 +5,5 @@ pub fn main() void { } // run -// target=x86_64-linux,x86_64-macos,aarch64-linux,aarch64-macos +// target=x86_64-linux,x86_64-macos // diff --git a/test/cases/x86_64-linux/comptime_var.0.zig b/test/cases/comptime_var.0.zig similarity index 81% rename from test/cases/x86_64-linux/comptime_var.0.zig rename to test/cases/comptime_var.0.zig index 70504eb364..14fb074c76 100644 --- a/test/cases/x86_64-linux/comptime_var.0.zig +++ b/test/cases/comptime_var.0.zig @@ -6,7 +6,8 @@ pub fn main() void { // error // output_mode=Exe -// target=x86_64-linux +// target=x86_64-macos,x86_64-linux +// link_libc=true // // :4:19: error: store to comptime variable depends on runtime condition // :4:11: note: runtime condition here diff --git a/test/cases/x86_64-linux/comptime_var.1.zig b/test/cases/comptime_var.1.zig similarity index 100% rename from test/cases/x86_64-linux/comptime_var.1.zig rename to test/cases/comptime_var.1.zig diff --git a/test/cases/x86_64-macos/comptime_var.2.zig b/test/cases/comptime_var.2.zig similarity index 82% rename from test/cases/x86_64-macos/comptime_var.2.zig rename to test/cases/comptime_var.2.zig index abd34255cd..7c99aba625 100644 --- a/test/cases/x86_64-macos/comptime_var.2.zig +++ b/test/cases/comptime_var.2.zig @@ -1,4 +1,4 @@ -extern "c" fn write(usize, usize, usize) usize; +extern "c" fn write(c_int, usize, usize) usize; pub fn main() void { comptime var len: u32 = 5; diff --git a/test/cases/x86_64-linux/comptime_var.3.zig b/test/cases/comptime_var.3.zig similarity index 100% rename from test/cases/x86_64-linux/comptime_var.3.zig rename to test/cases/comptime_var.3.zig diff --git a/test/cases/x86_64-linux/comptime_var.4.zig b/test/cases/comptime_var.4.zig similarity index 100% rename from test/cases/x86_64-linux/comptime_var.4.zig rename to test/cases/comptime_var.4.zig diff --git a/test/cases/x86_64-linux/comptime_var.5.zig b/test/cases/comptime_var.5.zig similarity index 100% rename from test/cases/x86_64-linux/comptime_var.5.zig rename to test/cases/comptime_var.5.zig diff --git a/test/cases/x86_64-macos/comptime_var.6.zig b/test/cases/comptime_var.6.zig similarity index 81% rename from test/cases/x86_64-macos/comptime_var.6.zig rename to test/cases/comptime_var.6.zig index 381e609bd1..3b655e381e 100644 --- a/test/cases/x86_64-macos/comptime_var.6.zig +++ b/test/cases/comptime_var.6.zig @@ -1,4 +1,4 @@ -extern "c" fn write(usize, usize, usize) usize; +extern "c" fn write(c_int, usize, usize) usize; pub fn main() void { comptime var i: u64 = 2; diff --git a/test/cases/conditional_branches.0.zig b/test/cases/conditional_branches.0.zig new file mode 100644 index 0000000000..61c9fdd50e --- /dev/null +++ b/test/cases/conditional_branches.0.zig @@ -0,0 +1,23 @@ +extern "c" fn write(c_int, usize, usize) usize; + +pub fn main() void { + foo(123); +} + +fn foo(x: u64) void { + if (x > 42) { + print(); + } +} + +fn print() void { + const str = "Hello, World!\n"; + _ = write(1, @ptrToInt(str.ptr), ptr.len); +} + +// run +// target=x86_64-linux,x86_64-macos +// link_libc=true +// +// Hello, World! +// diff --git a/test/cases/conditional_branches.1.zig b/test/cases/conditional_branches.1.zig new file mode 100644 index 0000000000..2668133a7c --- /dev/null +++ b/test/cases/conditional_branches.1.zig @@ -0,0 +1,25 @@ +extern "c" fn write(c_int, usize, usize) usize; + +pub fn main() void { + foo(true); +} + +fn foo(x: bool) void { + if (x) { + print(); + print(); + } else { + print(); + } +} + +fn print() void { + const str = "Hello, World!\n"; + _ = write(1, @ptrToInt(str.ptr), ptr.len); +} + +// run +// +// Hello, World! +// Hello, World! +// diff --git a/test/cases/wasm-wasi/conditions.0.zig b/test/cases/conditions.0.zig similarity index 100% rename from test/cases/wasm-wasi/conditions.0.zig rename to test/cases/conditions.0.zig diff --git a/test/cases/wasm-wasi/conditions.1.zig b/test/cases/conditions.1.zig similarity index 100% rename from test/cases/wasm-wasi/conditions.1.zig rename to test/cases/conditions.1.zig diff --git a/test/cases/wasm-wasi/conditions.2.zig b/test/cases/conditions.2.zig similarity index 100% rename from test/cases/wasm-wasi/conditions.2.zig rename to test/cases/conditions.2.zig diff --git a/test/cases/wasm-wasi/conditions.3.zig b/test/cases/conditions.3.zig similarity index 100% rename from test/cases/wasm-wasi/conditions.3.zig rename to test/cases/conditions.3.zig diff --git a/test/cases/wasm-wasi/conditions.4.zig b/test/cases/conditions.4.zig similarity index 100% rename from test/cases/wasm-wasi/conditions.4.zig rename to test/cases/conditions.4.zig diff --git a/test/cases/wasm-wasi/conditions.5.zig b/test/cases/conditions.5.zig similarity index 100% rename from test/cases/wasm-wasi/conditions.5.zig rename to test/cases/conditions.5.zig diff --git a/test/cases/wasm-wasi/error_unions.0.zig b/test/cases/error_unions.0.zig similarity index 100% rename from test/cases/wasm-wasi/error_unions.0.zig rename to test/cases/error_unions.0.zig diff --git a/test/cases/wasm-wasi/error_unions.1.zig b/test/cases/error_unions.1.zig similarity index 100% rename from test/cases/wasm-wasi/error_unions.1.zig rename to test/cases/error_unions.1.zig diff --git a/test/cases/wasm-wasi/error_unions.2.zig b/test/cases/error_unions.2.zig similarity index 100% rename from test/cases/wasm-wasi/error_unions.2.zig rename to test/cases/error_unions.2.zig diff --git a/test/cases/wasm-wasi/error_unions.3.zig b/test/cases/error_unions.3.zig similarity index 100% rename from test/cases/wasm-wasi/error_unions.3.zig rename to test/cases/error_unions.3.zig diff --git a/test/cases/wasm-wasi/error_unions.4.zig b/test/cases/error_unions.4.zig similarity index 100% rename from test/cases/wasm-wasi/error_unions.4.zig rename to test/cases/error_unions.4.zig diff --git a/test/cases/wasm-wasi/error_unions.5.zig b/test/cases/error_unions.5.zig similarity index 100% rename from test/cases/wasm-wasi/error_unions.5.zig rename to test/cases/error_unions.5.zig diff --git a/test/cases/errors.0.zig b/test/cases/errors.0.zig new file mode 100644 index 0000000000..5e6940ac3e --- /dev/null +++ b/test/cases/errors.0.zig @@ -0,0 +1,15 @@ +const std = @import("std"); + +pub fn main() void { + foo() catch print(); +} + +fn foo() anyerror!void {} + +fn print() void { + _ = std.os.write(1, "Hello, World!\n") catch {}; +} + +// run +// target=x86_64-macos +// diff --git a/test/cases/errors.1.zig b/test/cases/errors.1.zig new file mode 100644 index 0000000000..5f9582df8a --- /dev/null +++ b/test/cases/errors.1.zig @@ -0,0 +1,18 @@ +const std = @import("std"); + +pub fn main() void { + foo() catch print(); +} + +fn foo() anyerror!void { + return error.Test; +} + +fn print() void { + _ = std.os.write(1, "Hello, World!\n") catch {}; +} + +// run +// +// Hello, World! +// diff --git a/test/cases/arm-linux/errors.2.zig b/test/cases/errors.2.zig similarity index 100% rename from test/cases/arm-linux/errors.2.zig rename to test/cases/errors.2.zig diff --git a/test/cases/arm-linux/errors.3.zig b/test/cases/errors.3.zig similarity index 100% rename from test/cases/arm-linux/errors.3.zig rename to test/cases/errors.3.zig diff --git a/test/cases/exit.zig b/test/cases/exit.zig new file mode 100644 index 0000000000..23d17afe11 --- /dev/null +++ b/test/cases/exit.zig @@ -0,0 +1,5 @@ +pub fn main() void {} + +// run +// target=x86_64-linux,x86_64-macos,x86_64-windows,x86_64-plan9 +// diff --git a/test/cases/function_pointers.zig b/test/cases/function_pointers.zig new file mode 100644 index 0000000000..d48dc0da95 --- /dev/null +++ b/test/cases/function_pointers.zig @@ -0,0 +1,30 @@ +const std = @import("std"); + +const PrintFn = *const fn () void; + +pub fn main() void { + var printFn: PrintFn = stopSayingThat; + var i: u32 = 0; + while (i < 4) : (i += 1) printFn(); + + printFn = moveEveryZig; + printFn(); +} + +fn stopSayingThat() void { + _ = std.os.write(1, "Hello, my name is Inigo Montoya; you killed my father, prepare to die.\n") catch {}; +} + +fn moveEveryZig() void { + _ = std.os.write(1, "All your codebase are belong to us\n") catch {}; +} + +// run +// target=x86_64-macos +// +// Hello, my name is Inigo Montoya; you killed my father, prepare to die. +// Hello, my name is Inigo Montoya; you killed my father, prepare to die. +// Hello, my name is Inigo Montoya; you killed my father, prepare to die. +// Hello, my name is Inigo Montoya; you killed my father, prepare to die. +// All your codebase are belong to us +// diff --git a/test/cases/aarch64-macos/hello_world_with_updates.0.zig b/test/cases/hello_world_with_updates.0.zig similarity index 64% rename from test/cases/aarch64-macos/hello_world_with_updates.0.zig rename to test/cases/hello_world_with_updates.0.zig index f939a7fa71..bcd09204d0 100644 --- a/test/cases/aarch64-macos/hello_world_with_updates.0.zig +++ b/test/cases/hello_world_with_updates.0.zig @@ -1,5 +1,6 @@ // error // output_mode=Exe -// target=aarch64-macos +// target=x86_64-linux,x86_64-macos +// link_libc=true // // :?:?: error: root struct of file 'tmp' has no member named 'main' diff --git a/test/cases/aarch64-macos/hello_world_with_updates.1.zig b/test/cases/hello_world_with_updates.1.zig similarity index 100% rename from test/cases/aarch64-macos/hello_world_with_updates.1.zig rename to test/cases/hello_world_with_updates.1.zig diff --git a/test/cases/aarch64-macos/hello_world_with_updates.2.zig b/test/cases/hello_world_with_updates.2.zig similarity index 71% rename from test/cases/aarch64-macos/hello_world_with_updates.2.zig rename to test/cases/hello_world_with_updates.2.zig index fb8cb39edd..be6dc58c74 100644 --- a/test/cases/aarch64-macos/hello_world_with_updates.2.zig +++ b/test/cases/hello_world_with_updates.2.zig @@ -1,5 +1,5 @@ -extern "c" fn write(usize, usize, usize) usize; -extern "c" fn exit(usize) noreturn; +extern "c" fn write(c_int, usize, usize) usize; +extern "c" fn exit(c_int) noreturn; pub export fn main() noreturn { print(); diff --git a/test/cases/aarch64-macos/hello_world_with_updates.3.zig b/test/cases/hello_world_with_updates.3.zig similarity index 79% rename from test/cases/aarch64-macos/hello_world_with_updates.3.zig rename to test/cases/hello_world_with_updates.3.zig index f6e233886b..f464c379aa 100644 --- a/test/cases/aarch64-macos/hello_world_with_updates.3.zig +++ b/test/cases/hello_world_with_updates.3.zig @@ -1,4 +1,4 @@ -extern "c" fn write(usize, usize, usize) usize; +extern "c" fn write(c_int, usize, usize) usize; pub fn main() void { print(); diff --git a/test/cases/x86_64-macos/hello_world_with_updates.4.zig b/test/cases/hello_world_with_updates.4.zig similarity index 85% rename from test/cases/x86_64-macos/hello_world_with_updates.4.zig rename to test/cases/hello_world_with_updates.4.zig index f89cef7354..c9efbd0f35 100644 --- a/test/cases/x86_64-macos/hello_world_with_updates.4.zig +++ b/test/cases/hello_world_with_updates.4.zig @@ -1,4 +1,4 @@ -extern "c" fn write(usize, usize, usize) usize; +extern "c" fn write(c_int, usize, usize) usize; pub fn main() void { print(); diff --git a/test/cases/x86_64-macos/hello_world_with_updates.5.zig b/test/cases/hello_world_with_updates.5.zig similarity index 88% rename from test/cases/x86_64-macos/hello_world_with_updates.5.zig rename to test/cases/hello_world_with_updates.5.zig index 0d7f97578a..5070ea457c 100644 --- a/test/cases/x86_64-macos/hello_world_with_updates.5.zig +++ b/test/cases/hello_world_with_updates.5.zig @@ -1,4 +1,4 @@ -extern "c" fn write(usize, usize, usize) usize; +extern "c" fn write(c_int, usize, usize) usize; pub fn main() void { print(); diff --git a/test/cases/x86_64-macos/hello_world_with_updates.6.zig b/test/cases/hello_world_with_updates.6.zig similarity index 85% rename from test/cases/x86_64-macos/hello_world_with_updates.6.zig rename to test/cases/hello_world_with_updates.6.zig index 3ce2cb7176..a33f2954e5 100644 --- a/test/cases/x86_64-macos/hello_world_with_updates.6.zig +++ b/test/cases/hello_world_with_updates.6.zig @@ -1,4 +1,6 @@ -extern "c" fn write(usize, usize, usize) usize; +const builtin = @import("builtin"); + +extern "c" fn write(c_int, usize, usize) usize; pub fn main() void { print(); diff --git a/test/cases/large_add_function.zig b/test/cases/large_add_function.zig index 8b0e9b879b..61201d1545 100644 --- a/test/cases/large_add_function.zig +++ b/test/cases/large_add_function.zig @@ -33,6 +33,8 @@ fn assert(ok: bool) void { if (!ok) unreachable; } +// TODO: enable this for native backend + // run +// backend=llvm // target=aarch64-linux,aarch64-macos -// diff --git a/test/cases/wasm-wasi/locals.0.zig b/test/cases/locals.0.zig similarity index 100% rename from test/cases/wasm-wasi/locals.0.zig rename to test/cases/locals.0.zig diff --git a/test/cases/wasm-wasi/locals.1.zig b/test/cases/locals.1.zig similarity index 100% rename from test/cases/wasm-wasi/locals.1.zig rename to test/cases/locals.1.zig diff --git a/test/cases/only_1_function_and_it_gets_updated.0.zig b/test/cases/only_1_function_and_it_gets_updated.0.zig new file mode 100644 index 0000000000..eada595db8 --- /dev/null +++ b/test/cases/only_1_function_and_it_gets_updated.0.zig @@ -0,0 +1,7 @@ +pub export fn _start() noreturn { + while (true) {} +} + +// run +// target=x86_64-linux,x86_64-macos +// diff --git a/test/cases/only_1_function_and_it_gets_updated.1.zig b/test/cases/only_1_function_and_it_gets_updated.1.zig new file mode 100644 index 0000000000..39909f93b8 --- /dev/null +++ b/test/cases/only_1_function_and_it_gets_updated.1.zig @@ -0,0 +1,8 @@ +pub export fn _start() noreturn { + var dummy: u32 = 10; + _ = dummy; + while (true) {} +} + +// run +// diff --git a/test/cases/wasm-wasi/optionals.0.zig b/test/cases/optionals.0.zig similarity index 100% rename from test/cases/wasm-wasi/optionals.0.zig rename to test/cases/optionals.0.zig diff --git a/test/cases/wasm-wasi/optionals.1.zig b/test/cases/optionals.1.zig similarity index 100% rename from test/cases/wasm-wasi/optionals.1.zig rename to test/cases/optionals.1.zig diff --git a/test/cases/wasm-wasi/optionals.2.zig b/test/cases/optionals.2.zig similarity index 100% rename from test/cases/wasm-wasi/optionals.2.zig rename to test/cases/optionals.2.zig diff --git a/test/cases/wasm-wasi/optionals.3.zig b/test/cases/optionals.3.zig similarity index 100% rename from test/cases/wasm-wasi/optionals.3.zig rename to test/cases/optionals.3.zig diff --git a/test/cases/wasm-wasi/optionals.4.zig b/test/cases/optionals.4.zig similarity index 100% rename from test/cases/wasm-wasi/optionals.4.zig rename to test/cases/optionals.4.zig diff --git a/test/cases/parameters_and_return_values.0.zig b/test/cases/parameters_and_return_values.0.zig new file mode 100644 index 0000000000..45f0813e3d --- /dev/null +++ b/test/cases/parameters_and_return_values.0.zig @@ -0,0 +1,20 @@ +const std = @import("std"); + +pub fn main() void { + print(id(14)); +} + +fn id(x: u32) u32 { + return x; +} + +fn print(len: u32) void { + const str = "Hello, World!\n"; + _ = std.os.write(1, str[0..len]) catch {}; +} + +// run +// target=x86_64-macos +// +// Hello, World! +// diff --git a/test/cases/arm-linux/parameters_and_return_values.1.zig b/test/cases/parameters_and_return_values.1.zig similarity index 100% rename from test/cases/arm-linux/parameters_and_return_values.1.zig rename to test/cases/parameters_and_return_values.1.zig diff --git a/test/cases/plan9/exit.zig b/test/cases/plan9/exit.zig deleted file mode 100644 index 5c5cf21765..0000000000 --- a/test/cases/plan9/exit.zig +++ /dev/null @@ -1,5 +0,0 @@ -pub fn main() void {} - -// run -// target=x86_64-plan9 -// diff --git a/test/cases/plan9/hello_world_with_updates.0.zig b/test/cases/plan9/hello_world_with_updates.0.zig deleted file mode 100644 index 7e7c373251..0000000000 --- a/test/cases/plan9/hello_world_with_updates.0.zig +++ /dev/null @@ -1,28 +0,0 @@ -pub fn main() void { - const str = "Hello World!\n"; - asm volatile ( - \\push $0 - \\push %%r10 - \\push %%r11 - \\push $1 - \\push $0 - \\syscall - \\pop %%r11 - \\pop %%r11 - \\pop %%r11 - \\pop %%r11 - \\pop %%r11 - : - // pwrite - : [syscall_number] "{rbp}" (51), - [hey] "{r11}" (@ptrToInt(str)), - [strlen] "{r10}" (str.len), - : "rcx", "rbp", "r11", "memory" - ); -} - -// run -// target=x86_64-plan9 -// -// Hello World -// diff --git a/test/cases/plan9/hello_world_with_updates.1.zig b/test/cases/plan9/hello_world_with_updates.1.zig deleted file mode 100644 index 410045ab79..0000000000 --- a/test/cases/plan9/hello_world_with_updates.1.zig +++ /dev/null @@ -1,11 +0,0 @@ -const std = @import("std"); -pub fn main() void { - const str = "Hello World!\n"; - _ = std.os.plan9.pwrite(1, str, str.len, 0); -} - -// run -// target=x86_64-plan9 -// -// Hello World -// diff --git a/test/cases/wasm-wasi/pointers.0.zig b/test/cases/pointers.0.zig similarity index 100% rename from test/cases/wasm-wasi/pointers.0.zig rename to test/cases/pointers.0.zig diff --git a/test/cases/wasm-wasi/pointers.1.zig b/test/cases/pointers.1.zig similarity index 100% rename from test/cases/wasm-wasi/pointers.1.zig rename to test/cases/pointers.1.zig diff --git a/test/cases/print_u32s.zig b/test/cases/print_u32s.zig new file mode 100644 index 0000000000..f50e85d0aa --- /dev/null +++ b/test/cases/print_u32s.zig @@ -0,0 +1,28 @@ +const std = @import("std"); + +pub fn main() void { + printNumberHex(0x00000000); + printNumberHex(0xaaaaaaaa); + printNumberHex(0xdeadbeef); + printNumberHex(0x31415926); +} + +fn printNumberHex(x: u32) void { + const digit_chars = "0123456789abcdef"; + var i: u5 = 28; + while (true) : (i -= 4) { + const digit = (x >> i) & 0xf; + _ = std.os.write(1, &.{digit_chars[digit]}) catch {}; + if (i == 0) break; + } + _ = std.os.write(1, "\n") catch {}; +} + +// run +// target=x86_64-macos +// +// 00000000 +// aaaaaaaa +// deadbeef +// 31415926 +// diff --git a/test/cases/recursive_fibonacci.zig b/test/cases/recursive_fibonacci.zig index 24a7f75666..a2b8436dd7 100644 --- a/test/cases/recursive_fibonacci.zig +++ b/test/cases/recursive_fibonacci.zig @@ -20,5 +20,5 @@ fn assert(ok: bool) void { } // run -// target=x86_64-linux,x86_64-macos,arm-linux,wasm32-wasi +// target=x86_64-linux,x86_64-macos,wasm32-wasi // diff --git a/test/cases/arm-linux/spilling_registers.0.zig b/test/cases/spilling_registers.0.zig similarity index 95% rename from test/cases/arm-linux/spilling_registers.0.zig rename to test/cases/spilling_registers.0.zig index ac74e071ad..eb580cf5d8 100644 --- a/test/cases/arm-linux/spilling_registers.0.zig +++ b/test/cases/spilling_registers.0.zig @@ -34,5 +34,5 @@ fn assert(ok: bool) void { } // run -// target=arm-linux +// target=x86_64-linux,x86_64-macos // diff --git a/test/cases/arm-linux/spilling_registers.1.zig b/test/cases/spilling_registers.1.zig similarity index 100% rename from test/cases/arm-linux/spilling_registers.1.zig rename to test/cases/spilling_registers.1.zig diff --git a/test/cases/wasm-wasi/structs.0.zig b/test/cases/structs.0.zig similarity index 100% rename from test/cases/wasm-wasi/structs.0.zig rename to test/cases/structs.0.zig diff --git a/test/cases/wasm-wasi/structs.1.zig b/test/cases/structs.1.zig similarity index 100% rename from test/cases/wasm-wasi/structs.1.zig rename to test/cases/structs.1.zig diff --git a/test/cases/wasm-wasi/structs.2.zig b/test/cases/structs.2.zig similarity index 100% rename from test/cases/wasm-wasi/structs.2.zig rename to test/cases/structs.2.zig diff --git a/test/cases/wasm-wasi/structs.3.zig b/test/cases/structs.3.zig similarity index 100% rename from test/cases/wasm-wasi/structs.3.zig rename to test/cases/structs.3.zig diff --git a/test/cases/wasm-wasi/structs.4.zig b/test/cases/structs.4.zig similarity index 100% rename from test/cases/wasm-wasi/structs.4.zig rename to test/cases/structs.4.zig diff --git a/test/cases/wasm-wasi/switch.0.zig b/test/cases/switch.0.zig similarity index 100% rename from test/cases/wasm-wasi/switch.0.zig rename to test/cases/switch.0.zig diff --git a/test/cases/wasm-wasi/switch.1.zig b/test/cases/switch.1.zig similarity index 100% rename from test/cases/wasm-wasi/switch.1.zig rename to test/cases/switch.1.zig diff --git a/test/cases/wasm-wasi/switch.2.zig b/test/cases/switch.2.zig similarity index 100% rename from test/cases/wasm-wasi/switch.2.zig rename to test/cases/switch.2.zig diff --git a/test/cases/wasm-wasi/switch.3.zig b/test/cases/switch.3.zig similarity index 100% rename from test/cases/wasm-wasi/switch.3.zig rename to test/cases/switch.3.zig diff --git a/test/cases/wasm-wasi/while_loops.0.zig b/test/cases/while_loops.0.zig similarity index 100% rename from test/cases/wasm-wasi/while_loops.0.zig rename to test/cases/while_loops.0.zig diff --git a/test/cases/wasm-wasi/while_loops.1.zig b/test/cases/while_loops.1.zig similarity index 100% rename from test/cases/wasm-wasi/while_loops.1.zig rename to test/cases/while_loops.1.zig diff --git a/test/cases/wasm-wasi/while_loops.2.zig b/test/cases/while_loops.2.zig similarity index 100% rename from test/cases/wasm-wasi/while_loops.2.zig rename to test/cases/while_loops.2.zig diff --git a/test/cases/x86_64-linux/assert_function.18.zig b/test/cases/x86_64-linux/assert_function.18.zig deleted file mode 100644 index 31cf1207f3..0000000000 --- a/test/cases/x86_64-linux/assert_function.18.zig +++ /dev/null @@ -1,35 +0,0 @@ -const builtin = @import("builtin"); - -extern "c" fn write(usize, usize, usize) usize; - -pub fn main() void { - for ("hello") |_| print(); -} - -fn print() void { - switch (builtin.os.tag) { - .linux => { - asm volatile ("syscall" - : - : [number] "{rax}" (1), - [arg1] "{rdi}" (1), - [arg2] "{rsi}" (@ptrToInt("hello\n")), - [arg3] "{rdx}" (6), - : "rcx", "r11", "memory" - ); - }, - .macos => { - _ = write(1, @ptrToInt("hello\n"), 6); - }, - else => unreachable, - } -} - -// run -// -// hello -// hello -// hello -// hello -// hello -// diff --git a/test/cases/x86_64-linux/assert_function.7.zig b/test/cases/x86_64-linux/assert_function.7.zig deleted file mode 100644 index e6d18a5c3f..0000000000 --- a/test/cases/x86_64-linux/assert_function.7.zig +++ /dev/null @@ -1,28 +0,0 @@ -pub fn main() void { - var i: u32 = 0; - while (i < 4) : (i += 1) print(); - assert(i == 4); -} - -fn print() void { - asm volatile ("syscall" - : - : [number] "{rax}" (1), - [arg1] "{rdi}" (1), - [arg2] "{rsi}" (@ptrToInt("hello\n")), - [arg3] "{rdx}" (6), - : "rcx", "r11", "memory" - ); -} - -pub fn assert(ok: bool) void { - if (!ok) unreachable; // assertion failure -} - -// run -// -// hello -// hello -// hello -// hello -// diff --git a/test/cases/x86_64-linux/assert_function.8.zig b/test/cases/x86_64-linux/assert_function.8.zig deleted file mode 100644 index 1619452009..0000000000 --- a/test/cases/x86_64-linux/assert_function.8.zig +++ /dev/null @@ -1,25 +0,0 @@ -pub fn main() void { - var i: u32 = 0; - inline while (i < 4) : (i += 1) print(); - assert(i == 4); -} - -fn print() void { - asm volatile ("syscall" - : - : [number] "{rax}" (1), - [arg1] "{rdi}" (1), - [arg2] "{rsi}" (@ptrToInt("hello\n")), - [arg3] "{rdx}" (6), - : "rcx", "r11", "memory" - ); -} - -pub fn assert(ok: bool) void { - if (!ok) unreachable; // assertion failure -} - -// error -// -// :3:21: error: unable to resolve comptime value -// :3:21: note: condition in comptime branch must be comptime-known diff --git a/test/cases/x86_64-linux/comptime_var.2.zig b/test/cases/x86_64-linux/comptime_var.2.zig deleted file mode 100644 index 72bdfad90c..0000000000 --- a/test/cases/x86_64-linux/comptime_var.2.zig +++ /dev/null @@ -1,22 +0,0 @@ -pub fn main() void { - comptime var len: u32 = 5; - print(len); - len += 9; - print(len); -} - -fn print(len: usize) void { - asm volatile ("syscall" - : - : [number] "{rax}" (1), - [arg1] "{rdi}" (1), - [arg2] "{rsi}" (@ptrToInt("Hello, World!\n")), - [arg3] "{rdx}" (len), - : "rcx", "r11", "memory" - ); -} - -// run -// -// HelloHello, World! -// diff --git a/test/cases/x86_64-linux/comptime_var.6.zig b/test/cases/x86_64-linux/comptime_var.6.zig deleted file mode 100644 index 2790949561..0000000000 --- a/test/cases/x86_64-linux/comptime_var.6.zig +++ /dev/null @@ -1,20 +0,0 @@ -pub fn main() void { - comptime var i: u64 = 2; - inline while (i < 6) : (i += 1) { - print(i); - } -} -fn print(len: usize) void { - asm volatile ("syscall" - : - : [number] "{rax}" (1), - [arg1] "{rdi}" (1), - [arg2] "{rsi}" (@ptrToInt("Hello")), - [arg3] "{rdx}" (len), - : "rcx", "r11", "memory" - ); -} - -// run -// -// HeHelHellHello diff --git a/test/cases/x86_64-linux/hello_world_with_updates.0.zig b/test/cases/x86_64-linux/hello_world_with_updates.0.zig deleted file mode 100644 index c330234fdb..0000000000 --- a/test/cases/x86_64-linux/hello_world_with_updates.0.zig +++ /dev/null @@ -1,8 +0,0 @@ -// error -// output_mode=Exe -// target=x86_64-linux -// -// :?:?: error: root struct of file 'tmp' has no member named 'main' -// :?:?: note: called from here -// :?:?: note: called from here -// :?:?: note: called from here diff --git a/test/cases/x86_64-linux/hello_world_with_updates.1.zig b/test/cases/x86_64-linux/hello_world_with_updates.1.zig deleted file mode 100644 index dcf18bbf87..0000000000 --- a/test/cases/x86_64-linux/hello_world_with_updates.1.zig +++ /dev/null @@ -1,6 +0,0 @@ -pub export fn main() noreturn {} - -// error -// -// :1:22: error: function declared 'noreturn' implicitly returns -// :1:32: note: control flow reaches end of body here diff --git a/test/cases/x86_64-linux/hello_world_with_updates.2.zig b/test/cases/x86_64-linux/hello_world_with_updates.2.zig deleted file mode 100644 index fcea1870ce..0000000000 --- a/test/cases/x86_64-linux/hello_world_with_updates.2.zig +++ /dev/null @@ -1,32 +0,0 @@ -pub export fn _start() noreturn { - print(); - - exit(); -} - -fn print() void { - asm volatile ("syscall" - : - : [number] "{rax}" (1), - [arg1] "{rdi}" (1), - [arg2] "{rsi}" (@ptrToInt("Hello, World!\n")), - [arg3] "{rdx}" (14), - : "rcx", "r11", "memory" - ); - return; -} - -fn exit() noreturn { - asm volatile ("syscall" - : - : [number] "{rax}" (231), - [arg1] "{rdi}" (0), - : "rcx", "r11", "memory" - ); - unreachable; -} - -// run -// -// Hello, World! -// diff --git a/test/cases/x86_64-linux/hello_world_with_updates.3.zig b/test/cases/x86_64-linux/hello_world_with_updates.3.zig deleted file mode 100644 index 7812023372..0000000000 --- a/test/cases/x86_64-linux/hello_world_with_updates.3.zig +++ /dev/null @@ -1,20 +0,0 @@ -pub fn main() void { - print(); -} - -fn print() void { - asm volatile ("syscall" - : - : [number] "{rax}" (1), - [arg1] "{rdi}" (1), - [arg2] "{rsi}" (@ptrToInt("Hello, World!\n")), - [arg3] "{rdx}" (14), - : "rcx", "r11", "memory" - ); - return; -} - -// run -// -// Hello, World! -// diff --git a/test/cases/x86_64-linux/hello_world_with_updates.4.zig b/test/cases/x86_64-linux/hello_world_with_updates.4.zig deleted file mode 100644 index cdf47012b8..0000000000 --- a/test/cases/x86_64-linux/hello_world_with_updates.4.zig +++ /dev/null @@ -1,20 +0,0 @@ -pub fn main() void { - print(); -} - -fn print() void { - asm volatile ("syscall" - : - : [number] "{rax}" (1), - [arg1] "{rdi}" (1), - [arg2] "{rsi}" (@ptrToInt("What is up? This is a longer message that will force the data to be relocated in virtual address space.\n")), - [arg3] "{rdx}" (104), - : "rcx", "r11", "memory" - ); - return; -} - -// run -// -// What is up? This is a longer message that will force the data to be relocated in virtual address space. -// diff --git a/test/cases/x86_64-linux/hello_world_with_updates.5.zig b/test/cases/x86_64-linux/hello_world_with_updates.5.zig deleted file mode 100644 index 68c1e305f7..0000000000 --- a/test/cases/x86_64-linux/hello_world_with_updates.5.zig +++ /dev/null @@ -1,22 +0,0 @@ -pub fn main() void { - print(); - print(); -} - -fn print() void { - asm volatile ("syscall" - : - : [number] "{rax}" (1), - [arg1] "{rdi}" (1), - [arg2] "{rsi}" (@ptrToInt("What is up? This is a longer message that will force the data to be relocated in virtual address space.\n")), - [arg3] "{rdx}" (104), - : "rcx", "r11", "memory" - ); - return; -} - -// run -// -// What is up? This is a longer message that will force the data to be relocated in virtual address space. -// What is up? This is a longer message that will force the data to be relocated in virtual address space. -// diff --git a/test/cases/x86_64-linux/only_1_function_and_it_gets_updated.0.zig b/test/cases/x86_64-linux/only_1_function_and_it_gets_updated.0.zig deleted file mode 100644 index ecba1c8133..0000000000 --- a/test/cases/x86_64-linux/only_1_function_and_it_gets_updated.0.zig +++ /dev/null @@ -1,13 +0,0 @@ -pub export fn _start() noreturn { - asm volatile ("syscall" - : - : [number] "{rax}" (60), // exit - [arg1] "{rdi}" (0), - : "rcx", "r11", "memory" - ); - unreachable; -} - -// run -// target=x86_64-linux -// diff --git a/test/cases/x86_64-linux/only_1_function_and_it_gets_updated.1.zig b/test/cases/x86_64-linux/only_1_function_and_it_gets_updated.1.zig deleted file mode 100644 index 529acbcf38..0000000000 --- a/test/cases/x86_64-linux/only_1_function_and_it_gets_updated.1.zig +++ /dev/null @@ -1,12 +0,0 @@ -pub export fn _start() noreturn { - asm volatile ("syscall" - : - : [number] "{rax}" (231), // exit_group - [arg1] "{rdi}" (0), - : "rcx", "r11", "memory" - ); - unreachable; -} - -// run -// diff --git a/test/cases/x86_64-macos/assert_function.0.zig b/test/cases/x86_64-macos/assert_function.0.zig deleted file mode 100644 index 20e5cf0b97..0000000000 --- a/test/cases/x86_64-macos/assert_function.0.zig +++ /dev/null @@ -1,15 +0,0 @@ -pub fn main() void { - add(3, 4); -} - -fn add(a: u32, b: u32) void { - assert(a + b == 7); -} - -pub fn assert(ok: bool) void { - if (!ok) unreachable; // assertion failure -} - -// run -// target=x86_64-macos -// diff --git a/test/cases/x86_64-macos/assert_function.1.zig b/test/cases/x86_64-macos/assert_function.1.zig deleted file mode 100644 index ac2df25d85..0000000000 --- a/test/cases/x86_64-macos/assert_function.1.zig +++ /dev/null @@ -1,17 +0,0 @@ -pub fn main() void { - add(3, 4); -} - -fn add(a: u32, b: u32) void { - const c = a + b; // 7 - const d = a + c; // 10 - const e = d + b; // 14 - assert(e == 14); -} - -pub fn assert(ok: bool) void { - if (!ok) unreachable; // assertion failure -} - -// run -// diff --git a/test/cases/x86_64-macos/assert_function.10.zig b/test/cases/x86_64-macos/assert_function.10.zig deleted file mode 100644 index b3f1610cd6..0000000000 --- a/test/cases/x86_64-macos/assert_function.10.zig +++ /dev/null @@ -1,27 +0,0 @@ -pub fn main() void { - assert(add(3, 4) == 116); -} - -fn add(a: u32, b: u32) u32 { - const x: u32 = blk: { - const c = a + b; // 7 - const d = a + c; // 10 - const e = d + b; // 14 - const f = d + e; // 24 - const g = e + f; // 38 - const h = f + g; // 62 - const i = g + h; // 100 - const j = i + d; // 110 - break :blk j; - }; - const y = x + a; // 113 - const z = y + a; // 116 - return z; -} - -pub fn assert(ok: bool) void { - if (!ok) unreachable; // assertion failure -} - -// run -// diff --git a/test/cases/x86_64-macos/assert_function.11.zig b/test/cases/x86_64-macos/assert_function.11.zig deleted file mode 100644 index d64130a677..0000000000 --- a/test/cases/x86_64-macos/assert_function.11.zig +++ /dev/null @@ -1,66 +0,0 @@ -pub fn main() void { - assert(add(3, 4) == 1221); - assert(mul(3, 4) == 21609); -} - -fn add(a: u32, b: u32) u32 { - const x: u32 = blk: { - const c = a + b; // 7 - const d = a + c; // 10 - const e = d + b; // 14 - const f = d + e; // 24 - const g = e + f; // 38 - const h = f + g; // 62 - const i = g + h; // 100 - const j = i + d; // 110 - const k = i + j; // 210 - const l = j + k; // 320 - const m = l + c; // 327 - const n = m + d; // 337 - const o = n + e; // 351 - const p = o + f; // 375 - const q = p + g; // 413 - const r = q + h; // 475 - const s = r + i; // 575 - const t = s + j; // 685 - const u = t + k; // 895 - const v = u + l; // 1215 - break :blk v; - }; - const y = x + a; // 1218 - const z = y + a; // 1221 - return z; -} - -fn mul(a: u32, b: u32) u32 { - const x: u32 = blk: { - const c = a * a * a * a; // 81 - const d = a * a * a * b; // 108 - const e = a * a * b * a; // 108 - const f = a * a * b * b; // 144 - const g = a * b * a * a; // 108 - const h = a * b * a * b; // 144 - const i = a * b * b * a; // 144 - const j = a * b * b * b; // 192 - const k = b * a * a * a; // 108 - const l = b * a * a * b; // 144 - const m = b * a * b * a; // 144 - const n = b * a * b * b; // 192 - const o = b * b * a * a; // 144 - const p = b * b * a * b; // 192 - const q = b * b * b * a; // 192 - const r = b * b * b * b; // 256 - const s = c + d + e + f + g + h + i + j + k + l + m + n + o + p + q + r; // 2401 - break :blk s; - }; - const y = x * a; // 7203 - const z = y * a; // 21609 - return z; -} - -pub fn assert(ok: bool) void { - if (!ok) unreachable; // assertion failure -} - -// run -// diff --git a/test/cases/x86_64-macos/assert_function.12.zig b/test/cases/x86_64-macos/assert_function.12.zig deleted file mode 100644 index 4f64c1e062..0000000000 --- a/test/cases/x86_64-macos/assert_function.12.zig +++ /dev/null @@ -1,47 +0,0 @@ -pub fn main() void { - assert(add(3, 4) == 791); - assert(add(4, 3) == 79); -} - -fn add(a: u32, b: u32) u32 { - const x: u32 = if (a < b) blk: { - const c = a + b; // 7 - const d = a + c; // 10 - const e = d + b; // 14 - const f = d + e; // 24 - const g = e + f; // 38 - const h = f + g; // 62 - const i = g + h; // 100 - const j = i + d; // 110 - const k = i + j; // 210 - const l = k + c; // 217 - const m = l + d; // 227 - const n = m + e; // 241 - const o = n + f; // 265 - const p = o + g; // 303 - const q = p + h; // 365 - const r = q + i; // 465 - const s = r + j; // 575 - const t = s + k; // 785 - break :blk t; - } else blk: { - const t = b + b + a; // 10 - const c = a + t; // 14 - const d = c + t; // 24 - const e = d + t; // 34 - const f = e + t; // 44 - const g = f + t; // 54 - const h = c + g; // 68 - break :blk h + b; // 71 - }; - const y = x + a; // 788, 75 - const z = y + a; // 791, 79 - return z; -} - -pub fn assert(ok: bool) void { - if (!ok) unreachable; // assertion failure -} - -// run -// diff --git a/test/cases/x86_64-macos/assert_function.13.zig b/test/cases/x86_64-macos/assert_function.13.zig deleted file mode 100644 index 240abf0108..0000000000 --- a/test/cases/x86_64-macos/assert_function.13.zig +++ /dev/null @@ -1,19 +0,0 @@ -pub fn main() void { - const ignore = - \\ cool thx - \\ - ; - _ = ignore; - add('ぁ', '\x03'); -} - -fn add(a: u32, b: u32) void { - assert(a + b == 12356); -} - -pub fn assert(ok: bool) void { - if (!ok) unreachable; // assertion failure -} - -// run -// diff --git a/test/cases/x86_64-macos/assert_function.14.zig b/test/cases/x86_64-macos/assert_function.14.zig deleted file mode 100644 index d25100dcce..0000000000 --- a/test/cases/x86_64-macos/assert_function.14.zig +++ /dev/null @@ -1,17 +0,0 @@ -pub fn main() void { - add(aa, bb); -} - -const aa = 'ぁ'; -const bb = '\x03'; - -fn add(a: u32, b: u32) void { - assert(a + b == 12356); -} - -pub fn assert(ok: bool) void { - if (!ok) unreachable; // assertion failure -} - -// run -// diff --git a/test/cases/x86_64-macos/assert_function.15.zig b/test/cases/x86_64-macos/assert_function.15.zig deleted file mode 100644 index 33ae1ed5af..0000000000 --- a/test/cases/x86_64-macos/assert_function.15.zig +++ /dev/null @@ -1,10 +0,0 @@ -pub fn main() void { - assert("hello"[0] == 'h'); -} - -pub fn assert(ok: bool) void { - if (!ok) unreachable; // assertion failure -} - -// run -// diff --git a/test/cases/x86_64-macos/assert_function.16.zig b/test/cases/x86_64-macos/assert_function.16.zig deleted file mode 100644 index eef1136423..0000000000 --- a/test/cases/x86_64-macos/assert_function.16.zig +++ /dev/null @@ -1,11 +0,0 @@ -const hello = "hello".*; -pub fn main() void { - assert(hello[1] == 'e'); -} - -pub fn assert(ok: bool) void { - if (!ok) unreachable; // assertion failure -} - -// run -// diff --git a/test/cases/x86_64-macos/assert_function.17.zig b/test/cases/x86_64-macos/assert_function.17.zig deleted file mode 100644 index ac9dce3079..0000000000 --- a/test/cases/x86_64-macos/assert_function.17.zig +++ /dev/null @@ -1,11 +0,0 @@ -pub fn main() void { - var i: u64 = 0xFFEEDDCCBBAA9988; - assert(i == 0xFFEEDDCCBBAA9988); -} - -pub fn assert(ok: bool) void { - if (!ok) unreachable; // assertion failure -} - -// run -// diff --git a/test/cases/x86_64-macos/assert_function.18.zig b/test/cases/x86_64-macos/assert_function.18.zig deleted file mode 100644 index 31cf1207f3..0000000000 --- a/test/cases/x86_64-macos/assert_function.18.zig +++ /dev/null @@ -1,35 +0,0 @@ -const builtin = @import("builtin"); - -extern "c" fn write(usize, usize, usize) usize; - -pub fn main() void { - for ("hello") |_| print(); -} - -fn print() void { - switch (builtin.os.tag) { - .linux => { - asm volatile ("syscall" - : - : [number] "{rax}" (1), - [arg1] "{rdi}" (1), - [arg2] "{rsi}" (@ptrToInt("hello\n")), - [arg3] "{rdx}" (6), - : "rcx", "r11", "memory" - ); - }, - .macos => { - _ = write(1, @ptrToInt("hello\n"), 6); - }, - else => unreachable, - } -} - -// run -// -// hello -// hello -// hello -// hello -// hello -// diff --git a/test/cases/x86_64-macos/assert_function.2.zig b/test/cases/x86_64-macos/assert_function.2.zig deleted file mode 100644 index 8c1c510486..0000000000 --- a/test/cases/x86_64-macos/assert_function.2.zig +++ /dev/null @@ -1,21 +0,0 @@ -pub fn main() void { - add(3, 4); -} - -fn add(a: u32, b: u32) void { - const c = a + b; // 7 - const d = a + c; // 10 - const e = d + b; // 14 - const f = d + e; // 24 - const g = e + f; // 38 - const h = f + g; // 62 - const i = g + h; // 100 - assert(i == 100); -} - -pub fn assert(ok: bool) void { - if (!ok) unreachable; // assertion failure -} - -// run -// diff --git a/test/cases/x86_64-macos/assert_function.3.zig b/test/cases/x86_64-macos/assert_function.3.zig deleted file mode 100644 index a6829f8e02..0000000000 --- a/test/cases/x86_64-macos/assert_function.3.zig +++ /dev/null @@ -1,22 +0,0 @@ -pub fn main() void { - add(3, 4); -} - -fn add(a: u32, b: u32) void { - const c = a + b; // 7 - const d = a + c; // 10 - const e = d + b; // 14 - const f = d + e; // 24 - const g = e + f; // 38 - const h = f + g; // 62 - const i = g + h; // 100 - const j = i + d; // 110 - assert(j == 110); -} - -pub fn assert(ok: bool) void { - if (!ok) unreachable; // assertion failure -} - -// run -// diff --git a/test/cases/x86_64-macos/assert_function.4.zig b/test/cases/x86_64-macos/assert_function.4.zig deleted file mode 100644 index 69df4354c3..0000000000 --- a/test/cases/x86_64-macos/assert_function.4.zig +++ /dev/null @@ -1,15 +0,0 @@ -pub fn main() void { - assert(add(3, 4) == 7); - assert(add(20, 10) == 30); -} - -fn add(a: u32, b: u32) u32 { - return a + b; -} - -pub fn assert(ok: bool) void { - if (!ok) unreachable; // assertion failure -} - -// run -// diff --git a/test/cases/x86_64-macos/assert_function.5.zig b/test/cases/x86_64-macos/assert_function.5.zig deleted file mode 100644 index 89f3f7df4f..0000000000 --- a/test/cases/x86_64-macos/assert_function.5.zig +++ /dev/null @@ -1,19 +0,0 @@ -pub fn main() void { - assert(add(3, 4) == 7); - assert(add(20, 10) == 30); -} - -fn add(a: u32, b: u32) u32 { - var x: u32 = undefined; - x = 0; - x += a; - x += b; - return x; -} - -pub fn assert(ok: bool) void { - if (!ok) unreachable; // assertion failure -} - -// run -// diff --git a/test/cases/x86_64-macos/assert_function.6.zig b/test/cases/x86_64-macos/assert_function.6.zig deleted file mode 100644 index 1b1b75e68e..0000000000 --- a/test/cases/x86_64-macos/assert_function.6.zig +++ /dev/null @@ -1,9 +0,0 @@ -pub fn main() void { - const a: u32 = 2; - const b: ?u32 = a; - const c = b.?; - if (c != 2) unreachable; -} - -// run -// diff --git a/test/cases/x86_64-macos/assert_function.9.zig b/test/cases/x86_64-macos/assert_function.9.zig deleted file mode 100644 index c754bb7711..0000000000 --- a/test/cases/x86_64-macos/assert_function.9.zig +++ /dev/null @@ -1,22 +0,0 @@ -pub fn main() void { - assert(add(3, 4) == 20); -} - -fn add(a: u32, b: u32) u32 { - const x: u32 = blk: { - const c = a + b; // 7 - const d = a + c; // 10 - const e = d + b; // 14 - break :blk e; - }; - const y = x + a; // 17 - const z = y + a; // 20 - return z; -} - -pub fn assert(ok: bool) void { - if (!ok) unreachable; // assertion failure -} - -// run -// diff --git a/test/cases/x86_64-macos/comptime_var.0.zig b/test/cases/x86_64-macos/comptime_var.0.zig deleted file mode 100644 index b7bf9ebb14..0000000000 --- a/test/cases/x86_64-macos/comptime_var.0.zig +++ /dev/null @@ -1,12 +0,0 @@ -pub fn main() void { - var a: u32 = 0; - comptime var b: u32 = 0; - if (a == 0) b = 3; -} - -// error -// output_mode=Exe -// target=x86_64-macos -// -// :4:19: error: store to comptime variable depends on runtime condition -// :4:11: note: runtime condition here diff --git a/test/cases/x86_64-macos/comptime_var.1.zig b/test/cases/x86_64-macos/comptime_var.1.zig deleted file mode 100644 index 054d69250c..0000000000 --- a/test/cases/x86_64-macos/comptime_var.1.zig +++ /dev/null @@ -1,13 +0,0 @@ -pub fn main() void { - var a: u32 = 0; - comptime var b: u32 = 0; - switch (a) { - 0 => {}, - else => b = 3, - } -} - -// error -// -// :6:19: error: store to comptime variable depends on runtime condition -// :4:13: note: runtime condition here diff --git a/test/cases/x86_64-macos/comptime_var.3.zig b/test/cases/x86_64-macos/comptime_var.3.zig deleted file mode 100644 index 5d25d6556e..0000000000 --- a/test/cases/x86_64-macos/comptime_var.3.zig +++ /dev/null @@ -1,10 +0,0 @@ -comptime { - var x: i32 = 1; - x += 1; - if (x != 1) unreachable; -} -pub fn main() void {} - -// error -// -// :4:17: error: reached unreachable code diff --git a/test/cases/x86_64-macos/comptime_var.4.zig b/test/cases/x86_64-macos/comptime_var.4.zig deleted file mode 100644 index 74da6ef448..0000000000 --- a/test/cases/x86_64-macos/comptime_var.4.zig +++ /dev/null @@ -1,9 +0,0 @@ -pub fn main() void { - comptime var i: u64 = 0; - while (i < 5) : (i += 1) {} -} - -// error -// -// :3:24: error: cannot store to comptime variable in non-inline loop -// :3:5: note: non-inline loop here diff --git a/test/cases/x86_64-macos/comptime_var.5.zig b/test/cases/x86_64-macos/comptime_var.5.zig deleted file mode 100644 index 76a06f3d4b..0000000000 --- a/test/cases/x86_64-macos/comptime_var.5.zig +++ /dev/null @@ -1,15 +0,0 @@ -pub fn main() void { - var a: u32 = 0; - if (a == 0) { - comptime var b: u32 = 0; - b = 1; - } -} -comptime { - var x: i32 = 1; - x += 1; - if (x != 2) unreachable; -} - -// run -// diff --git a/test/cases/x86_64-macos/hello_world_with_updates.0.zig b/test/cases/x86_64-macos/hello_world_with_updates.0.zig deleted file mode 100644 index 7fc13a4fa5..0000000000 --- a/test/cases/x86_64-macos/hello_world_with_updates.0.zig +++ /dev/null @@ -1,5 +0,0 @@ -// error -// output_mode=Exe -// target=x86_64-macos -// -// :?:?: error: root struct of file 'tmp' has no member named 'main' diff --git a/test/cases/x86_64-macos/hello_world_with_updates.1.zig b/test/cases/x86_64-macos/hello_world_with_updates.1.zig deleted file mode 100644 index dcf18bbf87..0000000000 --- a/test/cases/x86_64-macos/hello_world_with_updates.1.zig +++ /dev/null @@ -1,6 +0,0 @@ -pub export fn main() noreturn {} - -// error -// -// :1:22: error: function declared 'noreturn' implicitly returns -// :1:32: note: control flow reaches end of body here diff --git a/test/cases/x86_64-macos/hello_world_with_updates.2.zig b/test/cases/x86_64-macos/hello_world_with_updates.2.zig deleted file mode 100644 index fb8cb39edd..0000000000 --- a/test/cases/x86_64-macos/hello_world_with_updates.2.zig +++ /dev/null @@ -1,19 +0,0 @@ -extern "c" fn write(usize, usize, usize) usize; -extern "c" fn exit(usize) noreturn; - -pub export fn main() noreturn { - print(); - - exit(0); -} - -fn print() void { - const msg = @ptrToInt("Hello, World!\n"); - const len = 14; - _ = write(1, msg, len); -} - -// run -// -// Hello, World! -// diff --git a/test/cases/x86_64-macos/hello_world_with_updates.3.zig b/test/cases/x86_64-macos/hello_world_with_updates.3.zig deleted file mode 100644 index f6e233886b..0000000000 --- a/test/cases/x86_64-macos/hello_world_with_updates.3.zig +++ /dev/null @@ -1,16 +0,0 @@ -extern "c" fn write(usize, usize, usize) usize; - -pub fn main() void { - print(); -} - -fn print() void { - const msg = @ptrToInt("Hello, World!\n"); - const len = 14; - _ = write(1, msg, len); -} - -// run -// -// Hello, World! -// diff --git a/test/cases/x86_64-windows/hello_world_with_updates.0.zig b/test/cases/x86_64-windows/hello_world_with_updates.0.zig deleted file mode 100644 index d322de2d1b..0000000000 --- a/test/cases/x86_64-windows/hello_world_with_updates.0.zig +++ /dev/null @@ -1,7 +0,0 @@ -// error -// output_mode=Exe -// target=x86_64-windows -// -// :?:?: error: root struct of file 'tmp' has no member named 'main' -// :?:?: note: called from here -// :?:?: note: called from here diff --git a/test/cases/x86_64-windows/hello_world_with_updates.1.zig b/test/cases/x86_64-windows/hello_world_with_updates.1.zig deleted file mode 100644 index dcf18bbf87..0000000000 --- a/test/cases/x86_64-windows/hello_world_with_updates.1.zig +++ /dev/null @@ -1,6 +0,0 @@ -pub export fn main() noreturn {} - -// error -// -// :1:22: error: function declared 'noreturn' implicitly returns -// :1:32: note: control flow reaches end of body here diff --git a/test/cases/x86_64-windows/hello_world_with_updates.2.zig b/test/cases/x86_64-windows/hello_world_with_updates.2.zig deleted file mode 100644 index 6c2fd5b24e..0000000000 --- a/test/cases/x86_64-windows/hello_world_with_updates.2.zig +++ /dev/null @@ -1,16 +0,0 @@ -const std = @import("std"); - -pub fn main() void { - print(); -} - -fn print() void { - const msg = "Hello, World!\n"; - const stdout = std.io.getStdOut(); - stdout.writeAll(msg) catch unreachable; -} - -// run -// -// Hello, World! -//