| author | |
| committer | |
| log | 66777ccd7d3744670fe58d451f982f29d65612ac |
| tree | 1e0244ecf56bedf8c0ad29b9c8d95791f4491871 |
| parent | 4664f793dc3fed2254863a5b6efc302c095890cb |
11 files changed, 52 insertions(+), 44 deletions(-)
test/cases/namespace_depends_on_compile_var/a.zig deleted-1| ... | @@ -1 +0,0 @@ | ||
| 1 | pub const a_bool = true; | ||
test/cases/namespace_depends_on_compile_var/b.zig deleted-1| ... | @@ -1 +0,0 @@ | ||
| 1 | pub const a_bool = false; | ||
test/cases/namespace_depends_on_compile_var/index.zig deleted-17| ... | @@ -1,17 +0,0 @@ | ||
| 1 | const assert = @import("std").debug.assert; | ||
| 2 | |||
| 3 | fn namespaceDependsOnCompileVar() { | ||
| 4 | @setFnTest(this, true); | ||
| 5 | |||
| 6 | if (some_namespace.a_bool) { | ||
| 7 | assert(some_namespace.a_bool); | ||
| 8 | } else { | ||
| 9 | assert(!some_namespace.a_bool); | ||
| 10 | } | ||
| 11 | } | ||
| 12 | const some_namespace = switch(@compileVar("os")) { | ||
| 13 | linux => @import("a.zig"), | ||
| 14 | else => @import("b.zig"), | ||
| 15 | }; | ||
| 16 | |||
| 17 | |||
test/cases/pub_enum/index.zig deleted-19| ... | @@ -1,19 +0,0 @@ | ||
| 1 | const assert = @import("std").debug.assert; | ||
| 2 | const other = @import("other.zig"); | ||
| 3 | |||
| 4 | fn pubEnum() { | ||
| 5 | @setFnTest(this, true); | ||
| 6 | |||
| 7 | pubEnumTest(other.APubEnum.Two); | ||
| 8 | } | ||
| 9 | fn pubEnumTest(foo: other.APubEnum) { | ||
| 10 | assert(foo == other.APubEnum.Two); | ||
| 11 | } | ||
| 12 | |||
| 13 | fn castWithImportedSymbol() { | ||
| 14 | @setFnTest(this, true); | ||
| 15 | |||
| 16 | assert(other.size_t(42) == 42); | ||
| 17 | } | ||
| 18 | |||
| 19 | |||
test/cases/pub_enum/other.zig deleted-6| ... | @@ -1,6 +0,0 @@ | ||
| 1 | pub enum APubEnum { | ||
| 2 | One, | ||
| 3 | Two, | ||
| 4 | Three, | ||
| 5 | } | ||
| 6 | pub const size_t = u64; | ||
test/cases3/namespace_depends_on_compile_var/a.zig created+1| ... | @@ -0,0 +1 @@ | ||
| 1 | pub const a_bool = true; | ||
test/cases3/namespace_depends_on_compile_var/b.zig created+1| ... | @@ -0,0 +1 @@ | ||
| 1 | pub const a_bool = false; | ||
test/cases3/namespace_depends_on_compile_var/index.zig created+19| ... | @@ -0,0 +1,19 @@ | ||
| 1 | fn namespaceDependsOnCompileVar() { | ||
| 2 | @setFnTest(this); | ||
| 3 | |||
| 4 | if (some_namespace.a_bool) { | ||
| 5 | assert(some_namespace.a_bool); | ||
| 6 | } else { | ||
| 7 | assert(!some_namespace.a_bool); | ||
| 8 | } | ||
| 9 | } | ||
| 10 | const some_namespace = switch(@compileVar("os")) { | ||
| 11 | Os.linux => @import("cases3/namespace_depends_on_compile_var/a.zig"), | ||
| 12 | else => @import("cases3/namespace_depends_on_compile_var/b.zig"), | ||
| 13 | }; | ||
| 14 | |||
| 15 | // TODO const assert = @import("std").debug.assert; | ||
| 16 | fn assert(ok: bool) { | ||
| 17 | if (!ok) | ||
| 18 | @unreachable(); | ||
| 19 | } | ||
test/cases3/pub_enum/index.zig created+23| ... | @@ -0,0 +1,23 @@ | ||
| 1 | const other = @import("cases3/pub_enum/other.zig"); | ||
| 2 | |||
| 3 | fn pubEnum() { | ||
| 4 | @setFnTest(this); | ||
| 5 | |||
| 6 | pubEnumTest(other.APubEnum.Two); | ||
| 7 | } | ||
| 8 | fn pubEnumTest(foo: other.APubEnum) { | ||
| 9 | assert(foo == other.APubEnum.Two); | ||
| 10 | } | ||
| 11 | |||
| 12 | fn castWithImportedSymbol() { | ||
| 13 | @setFnTest(this); | ||
| 14 | |||
| 15 | assert(other.size_t(42) == 42); | ||
| 16 | } | ||
| 17 | |||
| 18 | |||
| 19 | // TODO const assert = @import("std").debug.assert; | ||
| 20 | fn assert(ok: bool) { | ||
| 21 | if (!ok) | ||
| 22 | @unreachable(); | ||
| 23 | } | ||
test/cases3/pub_enum/other.zig created+6| ... | @@ -0,0 +1,6 @@ | ||
| 1 | pub const APubEnum = enum { | ||
| 2 | One, | ||
| 3 | Two, | ||
| 4 | Three, | ||
| 5 | }; | ||
| 6 | pub const size_t = u64; | ||
test/self_hosted3.zig+2| ... | @@ -17,7 +17,9 @@ const test_if = @import("cases3/if.zig"); | ... | @@ -17,7 +17,9 @@ const test_if = @import("cases3/if.zig"); |
| 17 | const test_import = @import("cases3/import.zig"); | 17 | const test_import = @import("cases3/import.zig"); |
| 18 | const test_math = @import("cases3/math.zig"); | 18 | const test_math = @import("cases3/math.zig"); |
| 19 | const test_misc = @import("cases3/misc.zig"); | 19 | const test_misc = @import("cases3/misc.zig"); |
| 20 | const test_namespace_depends_on_compile_var = @import("cases3/namespace_depends_on_compile_var/index.zig"); | ||
| 20 | const test_null = @import("cases3/null.zig"); | 21 | const test_null = @import("cases3/null.zig"); |
| 22 | const test_pub_enum = @import("cases3/pub_enum/index.zig"); | ||
| 21 | const test_sizeof_and_typeof = @import("cases3/sizeof_and_typeof.zig"); | 23 | const test_sizeof_and_typeof = @import("cases3/sizeof_and_typeof.zig"); |
| 22 | const test_struct = @import("cases3/struct.zig"); | 24 | const test_struct = @import("cases3/struct.zig"); |
| 23 | const test_struct_contains_slice_of_itself = @import("cases3/struct_contains_slice_of_itself.zig"); | 25 | const test_struct_contains_slice_of_itself = @import("cases3/struct_contains_slice_of_itself.zig"); |