authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-06-14 13:32:04-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-06-14 13:32:04-04:00
logacf16b5fb34e3ce985df16cba1be1455492e4564
treedd247111a8e9c4aa8a9ebd944bde87dfc24fb993
parent7c074b85165c6aff6bdaccd0fecea59489a2de58
signaturelock-open Commit is signed but in an unrecognized format.

uncomment more passing tests


9 files changed, 95 insertions(+), 94 deletions(-)

BRANCH_TODO+1
......@@ -2,6 +2,7 @@ Scratch pad for stuff to do before merging master
22=================================================
33
44uncomment all the behavior tests
5diff master branch to make sure
56
67restore test_runner.zig to master branch
78 - also the default panic function and unexpected_error_tracing. see the commit
test/stage1/behavior.zig+10-10
......@@ -40,20 +40,20 @@ comptime {
4040 //_ = @import("behavior/bugs/920.zig");
4141 _ = @import("behavior/byval_arg_var.zig");
4242 //_ = @import("behavior/cancel.zig");
43 //_ = @import("behavior/cast.zig");
43 _ = @import("behavior/cast.zig"); // TODO
4444 _ = @import("behavior/const_slice_child.zig");
4545 //_ = @import("behavior/coroutine_await_struct.zig");
4646 //_ = @import("behavior/coroutines.zig");
4747 _ = @import("behavior/defer.zig");
48 //_ = @import("behavior/enum.zig");
49 //_ = @import("behavior/enum_with_members.zig");
48 _ = @import("behavior/enum.zig");
49 _ = @import("behavior/enum_with_members.zig");
5050 //_ = @import("behavior/error.zig");
51 //_ = @import("behavior/eval.zig");
51 _ = @import("behavior/eval.zig"); // TODO
5252 _ = @import("behavior/field_parent_ptr.zig");
5353 _ = @import("behavior/fn.zig");
5454 _ = @import("behavior/fn_in_struct_in_comptime.zig");
5555 _ = @import("behavior/for.zig");
56 //_ = @import("behavior/generics.zig");
56 _ = @import("behavior/generics.zig"); // TODO
5757 _ = @import("behavior/hasdecl.zig");
5858 _ = @import("behavior/if.zig");
5959 //_ = @import("behavior/import.zig");
......@@ -61,15 +61,15 @@ comptime {
6161 _ = @import("behavior/inttoptr.zig");
6262 _ = @import("behavior/ir_block_deps.zig");
6363 //_ = @import("behavior/math.zig");
64 //_ = @import("behavior/merge_error_sets.zig");
65 //_ = @import("behavior/misc.zig");
64 _ = @import("behavior/merge_error_sets.zig");
65 _ = @import("behavior/misc.zig"); // TODO
6666 _ = @import("behavior/namespace_depends_on_compile_var.zig");
6767 _ = @import("behavior/new_stack_call.zig");
6868 _ = @import("behavior/null.zig");
69 //_ = @import("behavior/optional.zig");
69 _ = @import("behavior/optional.zig"); // TODO
7070 //_ = @import("behavior/pointers.zig");
7171 _ = @import("behavior/popcount.zig");
72 //_ = @import("behavior/ptrcast.zig");
72 _ = @import("behavior/ptrcast.zig"); // TODO
7373 _ = @import("behavior/pub_enum.zig");
7474 _ = @import("behavior/ref_var_in_if_after_if_2nd_switch_prong.zig");
7575 _ = @import("behavior/reflection.zig");
......@@ -94,6 +94,6 @@ comptime {
9494 _ = @import("behavior/var_args.zig");
9595 _ = @import("behavior/vector.zig");
9696 _ = @import("behavior/void.zig");
97 //_ = @import("behavior/while.zig");
97 _ = @import("behavior/while.zig"); // TODO
9898 _ = @import("behavior/widening.zig");
9999}
test/stage1/behavior/cast.zig+8-8
......@@ -124,14 +124,14 @@ fn returnNullLitFromOptionalTypeErrorRef() anyerror!?*A {
124124 return null;
125125}
126126
127test "peer type resolution: ?T and T" {
128 expect(peerTypeTAndOptionalT(true, false).? == 0);
129 expect(peerTypeTAndOptionalT(false, false).? == 3);
130 comptime {
131 expect(peerTypeTAndOptionalT(true, false).? == 0);
132 expect(peerTypeTAndOptionalT(false, false).? == 3);
133 }
134}
127//test "peer type resolution: ?T and T" {
128// expect(peerTypeTAndOptionalT(true, false).? == 0);
129// expect(peerTypeTAndOptionalT(false, false).? == 3);
130// comptime {
131// expect(peerTypeTAndOptionalT(true, false).? == 0);
132// expect(peerTypeTAndOptionalT(false, false).? == 3);
133// }
134//}
135135fn peerTypeTAndOptionalT(c: bool, b: bool) ?usize {
136136 if (c) {
137137 return if (b) null else usize(0);
test/stage1/behavior/eval.zig+22-22
......@@ -176,9 +176,9 @@ test "const slice" {
176176 }
177177}
178178
179test "try to trick eval with runtime if" {
180 expect(testTryToTrickEvalWithRuntimeIf(true) == 10);
181}
179//test "try to trick eval with runtime if" {
180// expect(testTryToTrickEvalWithRuntimeIf(true) == 10);
181//}
182182
183183fn testTryToTrickEvalWithRuntimeIf(b: bool) usize {
184184 comptime var i: usize = 0;
......@@ -572,14 +572,14 @@ pub const Info = struct {
572572
573573pub const diamond_info = Info{ .version = 0 };
574574
575test "comptime modification of const struct field" {
576 comptime {
577 var res = diamond_info;
578 res.version = 1;
579 expect(diamond_info.version == 0);
580 expect(res.version == 1);
581 }
582}
575//test "comptime modification of const struct field" {
576// comptime {
577// var res = diamond_info;
578// res.version = 1;
579// expect(diamond_info.version == 0);
580// expect(res.version == 1);
581// }
582//}
583583
584584test "pointer to type" {
585585 comptime {
......@@ -657,9 +657,9 @@ fn loopNTimes(comptime n: usize) void {
657657 inline while (i < n) : (i += 1) {}
658658}
659659
660test "variable inside inline loop that has different types on different iterations" {
661 testVarInsideInlineLoop(true, u32(42));
662}
660//test "variable inside inline loop that has different types on different iterations" {
661// testVarInsideInlineLoop(true, u32(42));
662//}
663663
664664fn testVarInsideInlineLoop(args: ...) void {
665665 comptime var i = 0;
......@@ -670,14 +670,14 @@ fn testVarInsideInlineLoop(args: ...) void {
670670 }
671671}
672672
673test "inline for with same type but different values" {
674 var res: usize = 0;
675 inline for ([_]type{ [2]u8, [1]u8, [2]u8 }) |T| {
676 var a: T = undefined;
677 res += a.len;
678 }
679 expect(res == 5);
680}
673//test "inline for with same type but different values" {
674// var res: usize = 0;
675// inline for ([_]type{ [2]u8, [1]u8, [2]u8 }) |T| {
676// var a: T = undefined;
677// res += a.len;
678// }
679// expect(res == 5);
680//}
681681
682682test "refer to the type of a generic function" {
683683 const Func = fn (type) void;
test/stage1/behavior/generics.zig+13-13
......@@ -80,19 +80,19 @@ test "function with return type type" {
8080 expect(list2.prealloc_items.len == 8);
8181}
8282
83test "generic struct" {
84 var a1 = GenNode(i32){
85 .value = 13,
86 .next = null,
87 };
88 var b1 = GenNode(bool){
89 .value = true,
90 .next = null,
91 };
92 expect(a1.value == 13);
93 expect(a1.value == a1.getVal());
94 expect(b1.getVal());
95}
83//test "generic struct" {
84// var a1 = GenNode(i32){
85// .value = 13,
86// .next = null,
87// };
88// var b1 = GenNode(bool){
89// .value = true,
90// .next = null,
91// };
92// expect(a1.value == 13);
93// expect(a1.value == a1.getVal());
94// expect(b1.getVal());
95//}
9696fn GenNode(comptime T: type) type {
9797 return struct {
9898 value: T,
test/stage1/behavior/misc.zig+7-7
......@@ -686,13 +686,13 @@ fn getNull() ?*i32 {
686686 return null;
687687}
688688
689test "thread local variable" {
690 const S = struct {
691 threadlocal var t: i32 = 1234;
692 };
693 S.t += 1;
694 expect(S.t == 1235);
695}
689//test "thread local variable" {
690// const S = struct {
691// threadlocal var t: i32 = 1234;
692// };
693// S.t += 1;
694// expect(S.t == 1235);
695//}
696696
697697test "unicode escape in character literal" {
698698 var a: u24 = '\U01f4a9';
test/stage1/behavior/optional.zig+5-5
......@@ -2,11 +2,11 @@ const expect = @import("std").testing.expect;
22
33pub const EmptyStruct = struct {};
44
5test "optional pointer to size zero struct" {
6 var e = EmptyStruct{};
7 var o: ?*EmptyStruct = &e;
8 expect(o != null);
9}
5//test "optional pointer to size zero struct" {
6// var e = EmptyStruct{};
7// var o: ?*EmptyStruct = &e;
8// expect(o != null);
9//}
1010
1111test "equality compare nullable pointers" {
1212 testNullPtrsEql();
test/stage1/behavior/ptrcast.zig+7-7
......@@ -59,10 +59,10 @@ test "comptime ptrcast keeps larger alignment" {
5959 }
6060}
6161
62test "implicit optional pointer to optional c_void pointer" {
63 var buf: [4]u8 = "aoeu";
64 var x: ?[*]u8 = &buf;
65 var y: ?*c_void = x;
66 var z = @ptrCast(*[4]u8, y);
67 expect(std.mem.eql(u8, z, "aoeu"));
68}
62//test "implicit optional pointer to optional c_void pointer" {
63// var buf: [4]u8 = "aoeu";
64// var x: ?[*]u8 = &buf;
65// var y: ?*c_void = x;
66// var z = @ptrCast(*[4]u8, y);
67// expect(std.mem.eql(u8, z, "aoeu"));
68//}
test/stage1/behavior/while.zig+22-22
......@@ -82,28 +82,28 @@ test "while with else" {
8282 expect(got_else == 1);
8383}
8484
85test "while with optional as condition" {
86 numbers_left = 10;
87 var sum: i32 = 0;
88 while (getNumberOrNull()) |value| {
89 sum += value;
90 }
91 expect(sum == 45);
92}
93
94test "while with optional as condition with else" {
95 numbers_left = 10;
96 var sum: i32 = 0;
97 var got_else: i32 = 0;
98 while (getNumberOrNull()) |value| {
99 sum += value;
100 expect(got_else == 0);
101 } else {
102 got_else += 1;
103 }
104 expect(sum == 45);
105 expect(got_else == 1);
106}
85//test "while with optional as condition" {
86// numbers_left = 10;
87// var sum: i32 = 0;
88// while (getNumberOrNull()) |value| {
89// sum += value;
90// }
91// expect(sum == 45);
92//}
93//
94//test "while with optional as condition with else" {
95// numbers_left = 10;
96// var sum: i32 = 0;
97// var got_else: i32 = 0;
98// while (getNumberOrNull()) |value| {
99// sum += value;
100// expect(got_else == 0);
101// } else {
102// got_else += 1;
103// }
104// expect(sum == 45);
105// expect(got_else == 1);
106//}
107107
108108test "while with error union condition" {
109109 numbers_left = 10;