zig/test/behavior/namespace_depends_on_compile_var.zig

16 lines
463 B
Zig
Raw Normal View History

const std = @import("std");
const builtin = @import("builtin");
const expect = std.testing.expect;
2017-01-05 08:57:48 +00:00
2017-05-24 02:38:31 +01:00
test "namespace depends on compile var" {
2016-12-26 07:42:31 +00:00
if (some_namespace.a_bool) {
try expect(some_namespace.a_bool);
2016-12-26 07:42:31 +00:00
} else {
try expect(!some_namespace.a_bool);
2016-12-26 07:42:31 +00:00
}
}
const some_namespace = switch (builtin.os.tag) {
.linux => @import("namespace_depends_on_compile_var/a.zig"),
2019-03-02 21:46:04 +00:00
else => @import("namespace_depends_on_compile_var/b.zig"),
2016-12-26 07:42:31 +00:00
};