IR: port more tests
This commit is contained in:
parent
4664f793dc
commit
66777ccd7d
|
@ -1,17 +0,0 @@
|
|||
const assert = @import("std").debug.assert;
|
||||
|
||||
fn namespaceDependsOnCompileVar() {
|
||||
@setFnTest(this, true);
|
||||
|
||||
if (some_namespace.a_bool) {
|
||||
assert(some_namespace.a_bool);
|
||||
} else {
|
||||
assert(!some_namespace.a_bool);
|
||||
}
|
||||
}
|
||||
const some_namespace = switch(@compileVar("os")) {
|
||||
linux => @import("a.zig"),
|
||||
else => @import("b.zig"),
|
||||
};
|
||||
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
const assert = @import("std").debug.assert;
|
||||
const other = @import("other.zig");
|
||||
|
||||
fn pubEnum() {
|
||||
@setFnTest(this, true);
|
||||
|
||||
pubEnumTest(other.APubEnum.Two);
|
||||
}
|
||||
fn pubEnumTest(foo: other.APubEnum) {
|
||||
assert(foo == other.APubEnum.Two);
|
||||
}
|
||||
|
||||
fn castWithImportedSymbol() {
|
||||
@setFnTest(this, true);
|
||||
|
||||
assert(other.size_t(42) == 42);
|
||||
}
|
||||
|
||||
|
19
test/cases3/namespace_depends_on_compile_var/index.zig
Normal file
19
test/cases3/namespace_depends_on_compile_var/index.zig
Normal file
|
@ -0,0 +1,19 @@
|
|||
fn namespaceDependsOnCompileVar() {
|
||||
@setFnTest(this);
|
||||
|
||||
if (some_namespace.a_bool) {
|
||||
assert(some_namespace.a_bool);
|
||||
} else {
|
||||
assert(!some_namespace.a_bool);
|
||||
}
|
||||
}
|
||||
const some_namespace = switch(@compileVar("os")) {
|
||||
Os.linux => @import("cases3/namespace_depends_on_compile_var/a.zig"),
|
||||
else => @import("cases3/namespace_depends_on_compile_var/b.zig"),
|
||||
};
|
||||
|
||||
// TODO const assert = @import("std").debug.assert;
|
||||
fn assert(ok: bool) {
|
||||
if (!ok)
|
||||
@unreachable();
|
||||
}
|
23
test/cases3/pub_enum/index.zig
Normal file
23
test/cases3/pub_enum/index.zig
Normal file
|
@ -0,0 +1,23 @@
|
|||
const other = @import("cases3/pub_enum/other.zig");
|
||||
|
||||
fn pubEnum() {
|
||||
@setFnTest(this);
|
||||
|
||||
pubEnumTest(other.APubEnum.Two);
|
||||
}
|
||||
fn pubEnumTest(foo: other.APubEnum) {
|
||||
assert(foo == other.APubEnum.Two);
|
||||
}
|
||||
|
||||
fn castWithImportedSymbol() {
|
||||
@setFnTest(this);
|
||||
|
||||
assert(other.size_t(42) == 42);
|
||||
}
|
||||
|
||||
|
||||
// TODO const assert = @import("std").debug.assert;
|
||||
fn assert(ok: bool) {
|
||||
if (!ok)
|
||||
@unreachable();
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
pub enum APubEnum {
|
||||
pub const APubEnum = enum {
|
||||
One,
|
||||
Two,
|
||||
Three,
|
||||
}
|
||||
};
|
||||
pub const size_t = u64;
|
|
@ -17,7 +17,9 @@ const test_if = @import("cases3/if.zig");
|
|||
const test_import = @import("cases3/import.zig");
|
||||
const test_math = @import("cases3/math.zig");
|
||||
const test_misc = @import("cases3/misc.zig");
|
||||
const test_namespace_depends_on_compile_var = @import("cases3/namespace_depends_on_compile_var/index.zig");
|
||||
const test_null = @import("cases3/null.zig");
|
||||
const test_pub_enum = @import("cases3/pub_enum/index.zig");
|
||||
const test_sizeof_and_typeof = @import("cases3/sizeof_and_typeof.zig");
|
||||
const test_struct = @import("cases3/struct.zig");
|
||||
const test_struct_contains_slice_of_itself = @import("cases3/struct_contains_slice_of_itself.zig");
|
||||
|
|
Loading…
Reference in New Issue
Block a user