C backend: Fix array declarations
This commit is contained in:
@@ -148,7 +148,7 @@ test "void arrays" {
|
||||
try expect(array.len == 4);
|
||||
}
|
||||
|
||||
test "nested arrays" {
|
||||
test "nested arrays of strings" {
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
|
||||
|
||||
@@ -162,6 +162,22 @@ test "nested arrays" {
|
||||
}
|
||||
}
|
||||
|
||||
test "nested arrays of integers" {
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
|
||||
|
||||
const array_of_numbers = [_][2]u8{
|
||||
[2]u8{ 1, 2 },
|
||||
[2]u8{ 3, 4 },
|
||||
};
|
||||
|
||||
try expect(array_of_numbers[0][0] == 1);
|
||||
try expect(array_of_numbers[0][1] == 2);
|
||||
try expect(array_of_numbers[1][0] == 3);
|
||||
try expect(array_of_numbers[1][1] == 4);
|
||||
}
|
||||
|
||||
test "implicit comptime in array type size" {
|
||||
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
|
||||
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
|
||||
|
||||
Reference in New Issue
Block a user