Commit 66777ccd7d
Changed files (8)
test/cases/namespace_depends_on_compile_var/index.zig
@@ -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"),
-};
-
-
test/cases/pub_enum/index.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);
-}
-
-
test/cases/namespace_depends_on_compile_var/a.zig โ test/cases3/namespace_depends_on_compile_var/a.zig
File renamed without changes
test/cases/namespace_depends_on_compile_var/b.zig โ test/cases3/namespace_depends_on_compile_var/b.zig
File renamed without changes
test/cases3/namespace_depends_on_compile_var/index.zig
@@ -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();
+}
test/cases3/pub_enum/index.zig
@@ -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();
+}
test/cases/pub_enum/other.zig โ test/cases3/pub_enum/other.zig
@@ -1,6 +1,6 @@
-pub enum APubEnum {
+pub const APubEnum = enum {
One,
Two,
Three,
-}
+};
pub const size_t = u64;
test/self_hosted3.zig
@@ -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");