aboutsummaryrefslogtreecommitdiff
path: root/test/behavior/basic.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2022-03-18 00:12:22 -0700
committerAndrew Kelley <andrew@ziglang.org>2022-03-18 00:12:22 -0700
commitf3f5a5d05b7056aceb408b701613242d053019ab (patch)
treeacb912950d734b0c25b38c1ae82a8558d1313057 /test/behavior/basic.zig
parent69d78bdae4a5d0ec5877add5936ae8e9daf09140 (diff)
downloadzig-f3f5a5d05b7056aceb408b701613242d053019ab.tar.gz
zig-f3f5a5d05b7056aceb408b701613242d053019ab.zip
stage2: improve `@typeName`
* make it always return a fully qualified name. stage1 is inconsistent about this. * AstGen: fix anon_name_strategy to correctly be `func` when anon type creation happens in the operand of the return expression. * Sema: implement type names for the "function" naming strategy. * Put "enum", "union", "opaque", or "struct" in place of "anon" when creating respective anonymous Decl names. * std.testing: add `expectStringStartsWith`. Didn't end up using it after all. Also this enables the real test runner for stage2 LLVM backend (sans wasm32) since it works now.
Diffstat (limited to 'test/behavior/basic.zig')
-rw-r--r--test/behavior/basic.zig15
1 files changed, 11 insertions, 4 deletions
diff --git a/test/behavior/basic.zig b/test/behavior/basic.zig
index bb3232c01c..889519b056 100644
--- a/test/behavior/basic.zig
+++ b/test/behavior/basic.zig
@@ -199,11 +199,18 @@ const OpaqueA = opaque {};
const OpaqueB = opaque {};
test "opaque types" {
- try expect(*OpaqueA != *OpaqueB);
- if (builtin.zig_backend == .stage1) { // TODO make this pass for stage2
- try expect(mem.eql(u8, @typeName(OpaqueA), "OpaqueA"));
- try expect(mem.eql(u8, @typeName(OpaqueB), "OpaqueB"));
+ if (builtin.zig_backend == .stage1) {
+ // stage1 gets the type names wrong
+ return error.SkipZigTest;
}
+
+ if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
+ if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
+
+ try expect(*OpaqueA != *OpaqueB);
+
+ try expect(mem.eql(u8, @typeName(OpaqueA), "behavior.basic.OpaqueA"));
+ try expect(mem.eql(u8, @typeName(OpaqueB), "behavior.basic.OpaqueB"));
}
const global_a: i32 = 1234;