categorize globals behavior tests

moves some tests that store to global variables to their own category
instead of being named after a GitHub issue.
This commit is contained in:
Andrew Kelley 2023-10-27 12:19:03 -07:00
parent 1c85b0acbb
commit dfe9cae4eb
3 changed files with 32 additions and 22 deletions

View File

@ -169,6 +169,7 @@ test {
_ = @import("behavior/fn_in_struct_in_comptime.zig");
_ = @import("behavior/for.zig");
_ = @import("behavior/generics.zig");
_ = @import("behavior/globals.zig");
_ = @import("behavior/hasdecl.zig");
_ = @import("behavior/hasfield.zig");
_ = @import("behavior/if.zig");
@ -252,7 +253,6 @@ test {
builtin.zig_backend != .stage2_c and
builtin.zig_backend != .stage2_spirv64)
{
_ = @import("behavior/bugs/13063.zig");
_ = @import("behavior/bugs/11227.zig");
_ = @import("behavior/bugs/14198.zig");
_ = @import("behavior/export.zig");

View File

@ -1,21 +0,0 @@
const std = @import("std");
const builtin = @import("builtin");
const expect = std.testing.expect;
var pos = [2]f32{ 0.0, 0.0 };
test "store to global array" {
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
try expect(pos[1] == 0.0);
pos = [2]f32{ 0.0, 1.0 };
try expect(pos[1] == 1.0);
}
var vpos = @Vector(2, f32){ 0.0, 0.0 };
test "store to global vector" {
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest; // TODO
try expect(vpos[1] == 0.0);
vpos = @Vector(2, f32){ 0.0, 1.0 };
try expect(vpos[1] == 1.0);
}

31
test/behavior/globals.zig Normal file
View File

@ -0,0 +1,31 @@
const std = @import("std");
const builtin = @import("builtin");
const expect = std.testing.expect;
var pos = [2]f32{ 0.0, 0.0 };
test "store to global array" {
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
try expect(pos[1] == 0.0);
pos = [2]f32{ 0.0, 1.0 };
try expect(pos[1] == 1.0);
}
var vpos = @Vector(2, f32){ 0.0, 0.0 };
test "store to global vector" {
if (builtin.zig_backend == .stage2_sparc64) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_c) return error.SkipZigTest;
if (builtin.zig_backend == .stage2_spirv64) return error.SkipZigTest;
try expect(vpos[1] == 0.0);
vpos = @Vector(2, f32){ 0.0, 1.0 };
try expect(vpos[1] == 1.0);
}