aboutsummaryrefslogtreecommitdiff
path: root/test/tests.zig
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2017-12-03 20:43:56 -0500
committerAndrew Kelley <superjoe30@gmail.com>2017-12-03 20:43:56 -0500
commit0ad1239522c70418990dc7b9da4e128da7cdd1d5 (patch)
tree3a434788633db0a3d6e30f779fc1239a7513205a /test/tests.zig
parent137c8f5e8a6023db24f90555e968b592a4b843e4 (diff)
downloadzig-0ad1239522c70418990dc7b9da4e128da7cdd1d5.tar.gz
zig-0ad1239522c70418990dc7b9da4e128da7cdd1d5.zip
rework enums and unions and their relationship to each other
* @enumTagName renamed to @tagName and it works on enums and union-enums * Remove the EnumTag type. Now there is only enum and union, and the tag type of a union is always an enum. * unions support specifying the tag enum type, and they support inferring an enum tag type. * Enums no longer support field types but they do support setting the tag values. Likewise union-enums when inferring an enum tag type support setting the tag values. * It is now an error for enums and unions to have 0 fields. * switch statements support union-enums closes #618
Diffstat (limited to 'test/tests.zig')
-rw-r--r--test/tests.zig10
1 files changed, 5 insertions, 5 deletions
diff --git a/test/tests.zig b/test/tests.zig
index 73d9646552..e74afa1755 100644
--- a/test/tests.zig
+++ b/test/tests.zig
@@ -150,8 +150,8 @@ pub fn addPkgTests(b: &build.Builder, test_filter: ?[]const u8, root_src: []cons
continue;
}
const these_tests = b.addTest(root_src);
- these_tests.setNamePrefix(b.fmt("{}-{}-{}-{}-{} ", name, @enumTagName(test_target.os),
- @enumTagName(test_target.arch), @enumTagName(mode), if (link_libc) "c" else "bare"));
+ these_tests.setNamePrefix(b.fmt("{}-{}-{}-{}-{} ", name, @tagName(test_target.os),
+ @tagName(test_target.arch), @tagName(mode), if (link_libc) "c" else "bare"));
these_tests.setFilter(test_filter);
these_tests.setBuildMode(mode);
if (!is_native) {
@@ -428,7 +428,7 @@ pub const CompareOutputContext = struct {
Special.None => {
for ([]Mode{Mode.Debug, Mode.ReleaseSafe, Mode.ReleaseFast}) |mode| {
const annotated_case_name = %%fmt.allocPrint(self.b.allocator, "{} {} ({})",
- "compare-output", case.name, @enumTagName(mode));
+ "compare-output", case.name, @tagName(mode));
if (self.test_filter) |filter| {
if (mem.indexOf(u8, annotated_case_name, filter) == null)
continue;
@@ -682,7 +682,7 @@ pub const CompileErrorContext = struct {
for ([]Mode{Mode.Debug, Mode.ReleaseSafe, Mode.ReleaseFast}) |mode| {
const annotated_case_name = %%fmt.allocPrint(self.b.allocator, "compile-error {} ({})",
- case.name, @enumTagName(mode));
+ case.name, @tagName(mode));
if (self.test_filter) |filter| {
if (mem.indexOf(u8, annotated_case_name, filter) == null)
continue;
@@ -750,7 +750,7 @@ pub const BuildExamplesContext = struct {
for ([]Mode{Mode.Debug, Mode.ReleaseSafe, Mode.ReleaseFast}) |mode| {
const annotated_case_name = %%fmt.allocPrint(self.b.allocator, "build {} ({})",
- root_src, @enumTagName(mode));
+ root_src, @tagName(mode));
if (self.test_filter) |filter| {
if (mem.indexOf(u8, annotated_case_name, filter) == null)
continue;