commit 106850fd4cc218f77d5b37738095c7afd7d7b74b (tree)
parent 2407ee954b780e5a6a73f88b0865feff365c5ce5
Author: Matthew Lugg <mlugg@mlugg.co.uk>
Date: Tue, 28 Apr 2026 12:56:38 +0100
tests: remove uses of `void{}`
In preparation for this syntax to be removed from the language per
https://github.com/ziglang/zig/issues/15213.
Diffstat:
6 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/test/behavior/array.zig b/test/behavior/array.zig
@@ -196,7 +196,7 @@ test "array with sentinels" {
test "void arrays" {
var array: [4]void = undefined;
- array[0] = void{};
+ array[0] = {};
array[1] = array[2];
try expect(@sizeOf(@TypeOf(array)) == 0);
try expect(array.len == 4);
diff --git a/test/behavior/basic.zig b/test/behavior/basic.zig
@@ -465,7 +465,7 @@ fn testPointerToVoidReturnType() anyerror!void {
const a = testPointerToVoidReturnType2();
return a.*;
}
-const test_pointer_to_void_return_type_x = void{};
+const test_pointer_to_void_return_type_x = {};
fn testPointerToVoidReturnType2() *const void {
return &test_pointer_to_void_return_type_x;
}
diff --git a/test/behavior/fn.zig b/test/behavior/fn.zig
@@ -280,7 +280,7 @@ test "implicit cast fn call result to optional in field result" {
test "void parameters" {
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
- try voidFun(1, void{}, 2, {});
+ try voidFun(1, {}, 2, {});
}
fn voidFun(a: i32, b: void, c: i32, d: void) !void {
_ = d;
diff --git a/test/behavior/reflection.zig b/test/behavior/reflection.zig
@@ -31,7 +31,7 @@ test "reflection: @field" {
var f = Foo{
.one = 42,
.two = true,
- .three = void{},
+ .three = {},
};
try expect(f.one == f.one);
diff --git a/test/behavior/struct.zig b/test/behavior/struct.zig
@@ -295,9 +295,9 @@ test "void struct fields" {
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
const foo = VoidStructFieldsFoo{
- .a = void{},
+ .a = {},
.b = 1,
- .c = void{},
+ .c = {},
};
try expect(foo.b == 1);
try expect(@sizeOf(VoidStructFieldsFoo) == 4);
diff --git a/test/standalone/cmakedefine/build.zig b/test/standalone/cmakedefine/build.zig
@@ -16,7 +16,7 @@ pub fn build(b: *std.Build) void {
.tenval = 10,
.stringval = "test",
- .boolnoval = void{},
+ .boolnoval = {},
.booltrueval = true,
.boolfalseval = false,
.boolzeroval = 0,