| author | |
| committer | |
| log | 25e4b16e25502ca5e76e4049ed9f727168782dde |
| tree | 947799ee1d22e621937c95842370cc7aee679412 |
| parent | a94267b2906e90aadf397b3f524e1069721fb496 |
40 files changed, 832 insertions(+), 140 deletions(-)
test/behavior.zig+110-110| ... | @@ -9,12 +9,16 @@ test { | ... | @@ -9,12 +9,16 @@ test { |
| 9 | _ = @import("behavior/bitcast.zig"); | 9 | _ = @import("behavior/bitcast.zig"); |
| 10 | _ = @import("behavior/bitreverse.zig"); | 10 | _ = @import("behavior/bitreverse.zig"); |
| 11 | _ = @import("behavior/byteswap.zig"); | 11 | _ = @import("behavior/byteswap.zig"); |
| 12 | _ = @import("behavior/byval_arg_var.zig"); | ||
| 12 | _ = @import("behavior/bool.zig"); | 13 | _ = @import("behavior/bool.zig"); |
| 13 | _ = @import("behavior/bugs/394.zig"); | 14 | _ = @import("behavior/bugs/394.zig"); |
| 15 | _ = @import("behavior/bugs/624.zig"); | ||
| 14 | _ = @import("behavior/bugs/655.zig"); | 16 | _ = @import("behavior/bugs/655.zig"); |
| 15 | _ = @import("behavior/bugs/656.zig"); | 17 | _ = @import("behavior/bugs/656.zig"); |
| 16 | _ = @import("behavior/bugs/679.zig"); | 18 | _ = @import("behavior/bugs/679.zig"); |
| 19 | _ = @import("behavior/bugs/704.zig"); | ||
| 17 | _ = @import("behavior/bugs/1025.zig"); | 20 | _ = @import("behavior/bugs/1025.zig"); |
| 21 | _ = @import("behavior/bugs/1076.zig"); | ||
| 18 | _ = @import("behavior/bugs/1111.zig"); | 22 | _ = @import("behavior/bugs/1111.zig"); |
| 19 | _ = @import("behavior/bugs/1277.zig"); | 23 | _ = @import("behavior/bugs/1277.zig"); |
| 20 | _ = @import("behavior/bugs/1310.zig"); | 24 | _ = @import("behavior/bugs/1310.zig"); |
| ... | @@ -27,149 +31,145 @@ test { | ... | @@ -27,149 +31,145 @@ test { |
| 27 | _ = @import("behavior/bugs/2006.zig"); | 31 | _ = @import("behavior/bugs/2006.zig"); |
| 28 | _ = @import("behavior/bugs/2346.zig"); | 32 | _ = @import("behavior/bugs/2346.zig"); |
| 29 | _ = @import("behavior/bugs/2578.zig"); | 33 | _ = @import("behavior/bugs/2578.zig"); |
| 34 | _ = @import("behavior/bugs/2692.zig"); | ||
| 35 | _ = @import("behavior/bugs/2889.zig"); | ||
| 30 | _ = @import("behavior/bugs/3007.zig"); | 36 | _ = @import("behavior/bugs/3007.zig"); |
| 37 | _ = @import("behavior/bugs/3046.zig"); | ||
| 31 | _ = @import("behavior/bugs/3112.zig"); | 38 | _ = @import("behavior/bugs/3112.zig"); |
| 32 | _ = @import("behavior/bugs/3367.zig"); | 39 | _ = @import("behavior/bugs/3367.zig"); |
| 40 | _ = @import("behavior/bugs/3586.zig"); | ||
| 41 | _ = @import("behavior/bugs/4560.zig"); | ||
| 42 | _ = @import("behavior/bugs/4769_a.zig"); | ||
| 43 | _ = @import("behavior/bugs/4769_b.zig"); | ||
| 44 | _ = @import("behavior/bugs/4954.zig"); | ||
| 33 | _ = @import("behavior/bugs/6850.zig"); | 45 | _ = @import("behavior/bugs/6850.zig"); |
| 34 | _ = @import("behavior/bugs/7250.zig"); | 46 | _ = @import("behavior/bugs/7250.zig"); |
| 47 | _ = @import("behavior/call.zig"); | ||
| 35 | _ = @import("behavior/cast.zig"); | 48 | _ = @import("behavior/cast.zig"); |
| 36 | _ = @import("behavior/comptime_memory.zig"); | 49 | _ = @import("behavior/comptime_memory.zig"); |
| 50 | _ = @import("behavior/defer.zig"); | ||
| 51 | _ = @import("behavior/enum.zig"); | ||
| 52 | _ = @import("behavior/error.zig"); | ||
| 53 | _ = @import("behavior/fn.zig"); | ||
| 37 | _ = @import("behavior/fn_delegation.zig"); | 54 | _ = @import("behavior/fn_delegation.zig"); |
| 38 | _ = @import("behavior/fn_in_struct_in_comptime.zig"); | 55 | _ = @import("behavior/fn_in_struct_in_comptime.zig"); |
| 56 | _ = @import("behavior/for.zig"); | ||
| 57 | _ = @import("behavior/generics.zig"); | ||
| 39 | _ = @import("behavior/hasdecl.zig"); | 58 | _ = @import("behavior/hasdecl.zig"); |
| 40 | _ = @import("behavior/hasfield.zig"); | 59 | _ = @import("behavior/hasfield.zig"); |
| 60 | _ = @import("behavior/if.zig"); | ||
| 61 | _ = @import("behavior/import.zig"); | ||
| 62 | _ = @import("behavior/incomplete_struct_param_tld.zig"); | ||
| 63 | _ = @import("behavior/int_div.zig"); | ||
| 64 | _ = @import("behavior/inttoptr.zig"); | ||
| 41 | _ = @import("behavior/ir_block_deps.zig"); | 65 | _ = @import("behavior/ir_block_deps.zig"); |
| 66 | _ = @import("behavior/member_func.zig"); | ||
| 42 | _ = @import("behavior/namespace_depends_on_compile_var.zig"); | 67 | _ = @import("behavior/namespace_depends_on_compile_var.zig"); |
| 68 | _ = @import("behavior/null.zig"); | ||
| 43 | _ = @import("behavior/optional.zig"); | 69 | _ = @import("behavior/optional.zig"); |
| 44 | _ = @import("behavior/prefetch.zig"); | 70 | _ = @import("behavior/prefetch.zig"); |
| 71 | _ = @import("behavior/pointers.zig"); | ||
| 45 | _ = @import("behavior/pub_enum.zig"); | 72 | _ = @import("behavior/pub_enum.zig"); |
| 73 | _ = @import("behavior/ptrcast.zig"); | ||
| 46 | _ = @import("behavior/reflection.zig"); | 74 | _ = @import("behavior/reflection.zig"); |
| 75 | _ = @import("behavior/ref_var_in_if_after_if_2nd_switch_prong.zig"); | ||
| 47 | _ = @import("behavior/slice.zig"); | 76 | _ = @import("behavior/slice.zig"); |
| 48 | _ = @import("behavior/slice_sentinel_comptime.zig"); | 77 | _ = @import("behavior/slice_sentinel_comptime.zig"); |
| 49 | _ = @import("behavior/struct.zig"); | 78 | _ = @import("behavior/struct.zig"); |
| 79 | _ = @import("behavior/src.zig"); | ||
| 80 | _ = @import("behavior/this.zig"); | ||
| 50 | _ = @import("behavior/truncate.zig"); | 81 | _ = @import("behavior/truncate.zig"); |
| 82 | _ = @import("behavior/try.zig"); | ||
| 51 | _ = @import("behavior/tuple.zig"); | 83 | _ = @import("behavior/tuple.zig"); |
| 52 | _ = @import("behavior/type.zig"); | 84 | _ = @import("behavior/type.zig"); |
| 85 | _ = @import("behavior/type_info.zig"); | ||
| 86 | _ = @import("behavior/undefined.zig"); | ||
| 87 | _ = @import("behavior/underscore.zig"); | ||
| 88 | _ = @import("behavior/union.zig"); | ||
| 89 | _ = @import("behavior/usingnamespace.zig"); | ||
| 53 | _ = @import("behavior/var_args.zig"); | 90 | _ = @import("behavior/var_args.zig"); |
| 54 | _ = @import("behavior/int_div.zig"); | 91 | _ = @import("behavior/void.zig"); |
| 92 | _ = @import("behavior/while.zig"); | ||
| 55 | 93 | ||
| 56 | // tests that don't pass for stage1 | 94 | // tests that don't pass for stage1 |
| 57 | if (builtin.zig_backend != .stage1) { | 95 | if (builtin.zig_backend != .stage1) { |
| 58 | _ = @import("behavior/decltest.zig"); | 96 | _ = @import("behavior/decltest.zig"); |
| 59 | } | 97 | } |
| 60 | 98 | ||
| 61 | if (builtin.zig_backend != .stage2_arm and builtin.zig_backend != .stage2_x86_64 and builtin.zig_backend != .stage2_aarch64) { | 99 | if (builtin.zig_backend != .stage2_arm and |
| 62 | // Tests that pass (partly) for stage1, llvm backend, C backend, wasm backend. | 100 | builtin.zig_backend != .stage2_x86_64 and |
| 63 | _ = @import("behavior/bugs/624.zig"); | 101 | builtin.zig_backend != .stage2_aarch64 and |
| 64 | _ = @import("behavior/bugs/704.zig"); | 102 | builtin.zig_backend != .stage2_wasm) |
| 65 | _ = @import("behavior/bugs/1076.zig"); | 103 | { |
| 66 | _ = @import("behavior/bugs/2692.zig"); | 104 | // Tests that pass for stage1, llvm backend, C backend |
| 67 | _ = @import("behavior/bugs/2889.zig"); | 105 | _ = @import("behavior/bugs/9584.zig"); |
| 68 | _ = @import("behavior/bugs/3046.zig"); | 106 | _ = @import("behavior/cast_int.zig"); |
| 69 | _ = @import("behavior/bugs/3586.zig"); | 107 | _ = @import("behavior/eval.zig"); |
| 70 | _ = @import("behavior/bugs/4560.zig"); | 108 | _ = @import("behavior/int128.zig"); |
| 71 | _ = @import("behavior/bugs/4769_a.zig"); | 109 | _ = @import("behavior/merge_error_sets.zig"); |
| 72 | _ = @import("behavior/bugs/4769_b.zig"); | 110 | _ = @import("behavior/translate_c_macros.zig"); |
| 73 | _ = @import("behavior/bugs/4954.zig"); | ||
| 74 | _ = @import("behavior/byval_arg_var.zig"); | ||
| 75 | _ = @import("behavior/call.zig"); | ||
| 76 | _ = @import("behavior/defer.zig"); | ||
| 77 | _ = @import("behavior/enum.zig"); | ||
| 78 | _ = @import("behavior/error.zig"); | ||
| 79 | _ = @import("behavior/fn.zig"); | ||
| 80 | _ = @import("behavior/for.zig"); | ||
| 81 | _ = @import("behavior/generics.zig"); | ||
| 82 | _ = @import("behavior/if.zig"); | ||
| 83 | _ = @import("behavior/import.zig"); | ||
| 84 | _ = @import("behavior/incomplete_struct_param_tld.zig"); | ||
| 85 | _ = @import("behavior/inttoptr.zig"); | ||
| 86 | _ = @import("behavior/member_func.zig"); | ||
| 87 | _ = @import("behavior/null.zig"); | ||
| 88 | _ = @import("behavior/pointers.zig"); | ||
| 89 | _ = @import("behavior/ptrcast.zig"); | ||
| 90 | _ = @import("behavior/ref_var_in_if_after_if_2nd_switch_prong.zig"); | ||
| 91 | _ = @import("behavior/src.zig"); | ||
| 92 | _ = @import("behavior/this.zig"); | ||
| 93 | _ = @import("behavior/try.zig"); | ||
| 94 | _ = @import("behavior/type_info.zig"); | ||
| 95 | _ = @import("behavior/undefined.zig"); | ||
| 96 | _ = @import("behavior/underscore.zig"); | ||
| 97 | _ = @import("behavior/union.zig"); | ||
| 98 | _ = @import("behavior/usingnamespace.zig"); | ||
| 99 | _ = @import("behavior/void.zig"); | ||
| 100 | _ = @import("behavior/while.zig"); | ||
| 101 | 111 | ||
| 102 | if (builtin.zig_backend != .stage2_wasm) { | 112 | if (builtin.zig_backend != .stage2_c) { |
| 103 | // Tests that pass for stage1, llvm backend, C backend | 113 | // Tests that pass for stage1 and the llvm backend. |
| 104 | _ = @import("behavior/bugs/9584.zig"); | 114 | _ = @import("behavior/atomics.zig"); |
| 105 | _ = @import("behavior/cast_int.zig"); | 115 | _ = @import("behavior/floatop.zig"); |
| 106 | _ = @import("behavior/eval.zig"); | 116 | _ = @import("behavior/math.zig"); |
| 107 | _ = @import("behavior/int128.zig"); | 117 | _ = @import("behavior/maximum_minimum.zig"); |
| 108 | _ = @import("behavior/merge_error_sets.zig"); | 118 | _ = @import("behavior/popcount.zig"); |
| 109 | _ = @import("behavior/translate_c_macros.zig"); | 119 | _ = @import("behavior/saturating_arithmetic.zig"); |
| 120 | _ = @import("behavior/sizeof_and_typeof.zig"); | ||
| 121 | _ = @import("behavior/switch.zig"); | ||
| 122 | _ = @import("behavior/widening.zig"); | ||
| 110 | 123 | ||
| 111 | if (builtin.zig_backend != .stage2_c) { | 124 | if (builtin.zig_backend == .stage1) { |
| 112 | // Tests that pass for stage1 and the llvm backend. | 125 | // Tests that only pass for the stage1 backend. |
| 113 | _ = @import("behavior/atomics.zig"); | 126 | if (builtin.os.tag != .wasi) { |
| 114 | _ = @import("behavior/floatop.zig"); | 127 | _ = @import("behavior/asm.zig"); |
| 115 | _ = @import("behavior/math.zig"); | 128 | _ = @import("behavior/async_fn.zig"); |
| 116 | _ = @import("behavior/maximum_minimum.zig"); | 129 | } |
| 117 | _ = @import("behavior/popcount.zig"); | 130 | _ = @import("behavior/await_struct.zig"); |
| 118 | _ = @import("behavior/saturating_arithmetic.zig"); | 131 | _ = @import("behavior/bugs/421.zig"); |
| 119 | _ = @import("behavior/sizeof_and_typeof.zig"); | 132 | _ = @import("behavior/bugs/529.zig"); |
| 120 | _ = @import("behavior/switch.zig"); | 133 | _ = @import("behavior/bugs/718.zig"); |
| 121 | _ = @import("behavior/widening.zig"); | 134 | _ = @import("behavior/bugs/726.zig"); |
| 135 | _ = @import("behavior/bugs/828.zig"); | ||
| 136 | _ = @import("behavior/bugs/920.zig"); | ||
| 137 | _ = @import("behavior/bugs/1120.zig"); | ||
| 138 | _ = @import("behavior/bugs/1421.zig"); | ||
| 122 | _ = @import("behavior/bugs/1442.zig"); | 139 | _ = @import("behavior/bugs/1442.zig"); |
| 123 | 140 | _ = @import("behavior/bugs/1607.zig"); | |
| 124 | if (builtin.zig_backend == .stage1) { | 141 | _ = @import("behavior/bugs/1851.zig"); |
| 125 | // Tests that only pass for the stage1 backend. | 142 | _ = @import("behavior/bugs/2114.zig"); |
| 126 | if (builtin.os.tag != .wasi) { | 143 | _ = @import("behavior/bugs/3384.zig"); |
| 127 | _ = @import("behavior/asm.zig"); | 144 | _ = @import("behavior/bugs/3742.zig"); |
| 128 | _ = @import("behavior/async_fn.zig"); | 145 | _ = @import("behavior/bugs/3779.zig"); |
| 129 | } | 146 | _ = @import("behavior/bugs/4328.zig"); |
| 130 | _ = @import("behavior/await_struct.zig"); | 147 | _ = @import("behavior/bugs/5398.zig"); |
| 131 | _ = @import("behavior/bugs/421.zig"); | 148 | _ = @import("behavior/bugs/5413.zig"); |
| 132 | _ = @import("behavior/bugs/529.zig"); | 149 | _ = @import("behavior/bugs/5474.zig"); |
| 133 | _ = @import("behavior/bugs/718.zig"); | 150 | _ = @import("behavior/bugs/5487.zig"); |
| 134 | _ = @import("behavior/bugs/726.zig"); | 151 | _ = @import("behavior/bugs/6456.zig"); |
| 135 | _ = @import("behavior/bugs/828.zig"); | 152 | _ = @import("behavior/bugs/6781.zig"); |
| 136 | _ = @import("behavior/bugs/920.zig"); | 153 | _ = @import("behavior/bugs/7003.zig"); |
| 137 | _ = @import("behavior/bugs/1120.zig"); | 154 | _ = @import("behavior/bugs/7027.zig"); |
| 138 | _ = @import("behavior/bugs/1421.zig"); | 155 | _ = @import("behavior/bugs/7047.zig"); |
| 139 | _ = @import("behavior/bugs/1607.zig"); | 156 | _ = @import("behavior/bugs/10147.zig"); |
| 140 | _ = @import("behavior/bugs/1851.zig"); | 157 | _ = @import("behavior/const_slice_child.zig"); |
| 141 | _ = @import("behavior/bugs/2114.zig"); | 158 | _ = @import("behavior/export_self_referential_type_info.zig"); |
| 142 | _ = @import("behavior/bugs/3384.zig"); | 159 | _ = @import("behavior/field_parent_ptr.zig"); |
| 143 | _ = @import("behavior/bugs/3742.zig"); | 160 | _ = @import("behavior/misc.zig"); |
| 144 | _ = @import("behavior/bugs/3779.zig"); | 161 | _ = @import("behavior/muladd.zig"); |
| 145 | _ = @import("behavior/bugs/4328.zig"); | 162 | _ = @import("behavior/select.zig"); |
| 146 | _ = @import("behavior/bugs/5398.zig"); | 163 | _ = @import("behavior/shuffle.zig"); |
| 147 | _ = @import("behavior/bugs/5413.zig"); | 164 | _ = @import("behavior/struct_contains_null_ptr_itself.zig"); |
| 148 | _ = @import("behavior/bugs/5474.zig"); | 165 | _ = @import("behavior/struct_contains_slice_of_itself.zig"); |
| 149 | _ = @import("behavior/bugs/5487.zig"); | 166 | _ = @import("behavior/switch_prong_err_enum.zig"); |
| 150 | _ = @import("behavior/bugs/6456.zig"); | 167 | _ = @import("behavior/switch_prong_implicit_cast.zig"); |
| 151 | _ = @import("behavior/bugs/6781.zig"); | 168 | _ = @import("behavior/typename.zig"); |
| 152 | _ = @import("behavior/bugs/7003.zig"); | 169 | _ = @import("behavior/union_with_members.zig"); |
| 153 | _ = @import("behavior/bugs/7027.zig"); | 170 | _ = @import("behavior/vector.zig"); |
| 154 | _ = @import("behavior/bugs/7047.zig"); | 171 | if (builtin.target.cpu.arch == .wasm32) { |
| 155 | _ = @import("behavior/bugs/10147.zig"); | 172 | _ = @import("behavior/wasm.zig"); |
| 156 | _ = @import("behavior/const_slice_child.zig"); | ||
| 157 | _ = @import("behavior/export_self_referential_type_info.zig"); | ||
| 158 | _ = @import("behavior/field_parent_ptr.zig"); | ||
| 159 | _ = @import("behavior/misc.zig"); | ||
| 160 | _ = @import("behavior/muladd.zig"); | ||
| 161 | _ = @import("behavior/select.zig"); | ||
| 162 | _ = @import("behavior/shuffle.zig"); | ||
| 163 | _ = @import("behavior/struct_contains_null_ptr_itself.zig"); | ||
| 164 | _ = @import("behavior/struct_contains_slice_of_itself.zig"); | ||
| 165 | _ = @import("behavior/switch_prong_err_enum.zig"); | ||
| 166 | _ = @import("behavior/switch_prong_implicit_cast.zig"); | ||
| 167 | _ = @import("behavior/typename.zig"); | ||
| 168 | _ = @import("behavior/union_with_members.zig"); | ||
| 169 | _ = @import("behavior/vector.zig"); | ||
| 170 | if (builtin.target.cpu.arch == .wasm32) { | ||
| 171 | _ = @import("behavior/wasm.zig"); | ||
| 172 | } | ||
| 173 | } | 173 | } |
| 174 | } | 174 | } |
| 175 | } | 175 | } |
test/behavior/align.zig-6| ... | @@ -180,8 +180,6 @@ fn noop4() align(4) void {} | ... | @@ -180,8 +180,6 @@ fn noop4() align(4) void {} |
| 180 | test "function alignment" { | 180 | test "function alignment" { |
| 181 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | 181 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 182 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; | 182 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; |
| 183 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; | ||
| 184 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 185 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | 183 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 186 | 184 | ||
| 187 | // function alignment is a compile error on wasm32/wasm64 | 185 | // function alignment is a compile error on wasm32/wasm64 |
| ... | @@ -199,7 +197,6 @@ test "implicitly decreasing fn alignment" { | ... | @@ -199,7 +197,6 @@ test "implicitly decreasing fn alignment" { |
| 199 | if (builtin.zig_backend == .stage1) return error.SkipZigTest; | 197 | if (builtin.zig_backend == .stage1) return error.SkipZigTest; |
| 200 | if (builtin.zig_backend == .stage2_llvm) return error.SkipZigTest; | 198 | if (builtin.zig_backend == .stage2_llvm) return error.SkipZigTest; |
| 201 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; | 199 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; |
| 202 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; | ||
| 203 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | 200 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| 204 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | 201 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 205 | 202 | ||
| ... | @@ -226,8 +223,6 @@ test "@alignCast functions" { | ... | @@ -226,8 +223,6 @@ test "@alignCast functions" { |
| 226 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | 223 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 227 | if (builtin.zig_backend == .stage1) return error.SkipZigTest; | 224 | if (builtin.zig_backend == .stage1) return error.SkipZigTest; |
| 228 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; | 225 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; |
| 229 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; | ||
| 230 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 231 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | 226 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 232 | 227 | ||
| 233 | // function alignment is a compile error on wasm32/wasm64 | 228 | // function alignment is a compile error on wasm32/wasm64 |
| ... | @@ -250,7 +245,6 @@ test "generic function with align param" { | ... | @@ -250,7 +245,6 @@ test "generic function with align param" { |
| 250 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | 245 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 251 | if (builtin.zig_backend == .stage2_llvm) return error.SkipZigTest; | 246 | if (builtin.zig_backend == .stage2_llvm) return error.SkipZigTest; |
| 252 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; | 247 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; |
| 253 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; | ||
| 254 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | 248 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| 255 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | 249 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 256 | 250 |
test/behavior/array.zig+6-4| ... | @@ -49,7 +49,7 @@ fn getArrayLen(a: []const u32) usize { | ... | @@ -49,7 +49,7 @@ fn getArrayLen(a: []const u32) usize { |
| 49 | 49 | ||
| 50 | test "array init with mult" { | 50 | test "array init with mult" { |
| 51 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | 51 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 52 | if (builtin.zig_backend == .stage2_x86_64 or builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | 52 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 53 | 53 | ||
| 54 | const a = 'a'; | 54 | const a = 'a'; |
| 55 | var i: [8]u8 = [2]u8{ a, 'b' } ** 4; | 55 | var i: [8]u8 = [2]u8{ a, 'b' } ** 4; |
| ... | @@ -112,7 +112,7 @@ test "array len field" { | ... | @@ -112,7 +112,7 @@ test "array len field" { |
| 112 | 112 | ||
| 113 | test "array with sentinels" { | 113 | test "array with sentinels" { |
| 114 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | 114 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 115 | if (builtin.zig_backend == .stage2_x86_64 or builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | 115 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 116 | 116 | ||
| 117 | const S = struct { | 117 | const S = struct { |
| 118 | fn doTheTest(is_ct: bool) !void { | 118 | fn doTheTest(is_ct: bool) !void { |
| ... | @@ -179,7 +179,8 @@ fn plusOne(x: u32) u32 { | ... | @@ -179,7 +179,8 @@ fn plusOne(x: u32) u32 { |
| 179 | 179 | ||
| 180 | test "single-item pointer to array indexing and slicing" { | 180 | test "single-item pointer to array indexing and slicing" { |
| 181 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | 181 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 182 | if (builtin.zig_backend == .stage2_x86_64 or builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | 182 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| 183 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 183 | 184 | ||
| 184 | try testSingleItemPtrArrayIndexSlice(); | 185 | try testSingleItemPtrArrayIndexSlice(); |
| 185 | comptime try testSingleItemPtrArrayIndexSlice(); | 186 | comptime try testSingleItemPtrArrayIndexSlice(); |
| ... | @@ -205,7 +206,8 @@ fn doSomeMangling(array: *[4]u8) void { | ... | @@ -205,7 +206,8 @@ fn doSomeMangling(array: *[4]u8) void { |
| 205 | 206 | ||
| 206 | test "implicit cast zero sized array ptr to slice" { | 207 | test "implicit cast zero sized array ptr to slice" { |
| 207 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | 208 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 208 | if (builtin.zig_backend == .stage2_x86_64 or builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | 209 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| 210 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 209 | 211 | ||
| 210 | { | 212 | { |
| 211 | var b = "".*; | 213 | var b = "".*; |
test/behavior/basic.zig-6| ... | @@ -117,7 +117,6 @@ fn first4KeysOfHomeRow() []const u8 { | ... | @@ -117,7 +117,6 @@ fn first4KeysOfHomeRow() []const u8 { |
| 117 | test "return string from function" { | 117 | test "return string from function" { |
| 118 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | 118 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 119 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | 119 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 120 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 121 | 120 | ||
| 122 | try expect(mem.eql(u8, first4KeysOfHomeRow(), "aoeu")); | 121 | try expect(mem.eql(u8, first4KeysOfHomeRow(), "aoeu")); |
| 123 | } | 122 | } |
| ... | @@ -231,7 +230,6 @@ test "compile time global reinterpret" { | ... | @@ -231,7 +230,6 @@ test "compile time global reinterpret" { |
| 231 | 230 | ||
| 232 | test "cast undefined" { | 231 | test "cast undefined" { |
| 233 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | 232 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 234 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 235 | 233 | ||
| 236 | const array: [100]u8 = undefined; | 234 | const array: [100]u8 = undefined; |
| 237 | const slice = @as([]const u8, &array); | 235 | const slice = @as([]const u8, &array); |
| ... | @@ -303,7 +301,6 @@ test "call function pointer in struct" { | ... | @@ -303,7 +301,6 @@ test "call function pointer in struct" { |
| 303 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | 301 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 304 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | 302 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 305 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | 303 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| 306 | |||
| 307 | if (builtin.zig_backend == .stage1) return error.SkipZigTest; | 304 | if (builtin.zig_backend == .stage1) return error.SkipZigTest; |
| 308 | 305 | ||
| 309 | try expect(mem.eql(u8, f3(true), "a")); | 306 | try expect(mem.eql(u8, f3(true), "a")); |
| ... | @@ -382,7 +379,6 @@ fn testMemcpyMemset() !void { | ... | @@ -382,7 +379,6 @@ fn testMemcpyMemset() !void { |
| 382 | test "variable is allowed to be a pointer to an opaque type" { | 379 | test "variable is allowed to be a pointer to an opaque type" { |
| 383 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | 380 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 384 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | 381 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 385 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 386 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO | 382 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO |
| 387 | 383 | ||
| 388 | var x: i32 = 1234; | 384 | var x: i32 = 1234; |
| ... | @@ -425,7 +421,6 @@ test "array 2D const double ptr" { | ... | @@ -425,7 +421,6 @@ test "array 2D const double ptr" { |
| 425 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | 421 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 426 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | 422 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 427 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | 423 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| 428 | |||
| 429 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | 424 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO |
| 430 | 425 | ||
| 431 | const rect_2d_vertexes = [_][1]f32{ | 426 | const rect_2d_vertexes = [_][1]f32{ |
| ... | @@ -476,7 +471,6 @@ fn testArray2DConstDoublePtr(ptr: *const f32) !void { | ... | @@ -476,7 +471,6 @@ fn testArray2DConstDoublePtr(ptr: *const f32) !void { |
| 476 | test "double implicit cast in same expression" { | 471 | test "double implicit cast in same expression" { |
| 477 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | 472 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 478 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | 473 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 479 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 480 | 474 | ||
| 481 | var x = @as(i32, @as(u16, nine())); | 475 | var x = @as(i32, @as(u16, nine())); |
| 482 | try expect(x == 9); | 476 | try expect(x == 9); |
test/behavior/bugs/1076.zig+5| ... | @@ -1,8 +1,13 @@ | ... | @@ -1,8 +1,13 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | const builtin = @import("builtin"); | ||
| 2 | const mem = std.mem; | 3 | const mem = std.mem; |
| 3 | const expect = std.testing.expect; | 4 | const expect = std.testing.expect; |
| 4 | 5 | ||
| 5 | test "comptime code should not modify constant data" { | 6 | test "comptime code should not modify constant data" { |
| 7 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 8 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 9 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 10 | |||
| 6 | try testCastPtrOfArrayToSliceAndPtr(); | 11 | try testCastPtrOfArrayToSliceAndPtr(); |
| 7 | comptime try testCastPtrOfArrayToSliceAndPtr(); | 12 | comptime try testCastPtrOfArrayToSliceAndPtr(); |
| 8 | } | 13 | } |
test/behavior/bugs/1442.zig+3| ... | @@ -1,4 +1,5 @@ | ... | @@ -1,4 +1,5 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | const builtin = @import("builtin"); | ||
| 2 | 3 | ||
| 3 | const Union = union(enum) { | 4 | const Union = union(enum) { |
| 4 | Text: []const u8, | 5 | Text: []const u8, |
| ... | @@ -6,6 +7,8 @@ const Union = union(enum) { | ... | @@ -6,6 +7,8 @@ const Union = union(enum) { |
| 6 | }; | 7 | }; |
| 7 | 8 | ||
| 8 | test "const error union field alignment" { | 9 | test "const error union field alignment" { |
| 10 | if (builtin.zig_backend != .stage1) return error.SkipZigTest; | ||
| 11 | |||
| 9 | var union_or_err: anyerror!Union = Union{ .Color = 1234 }; | 12 | var union_or_err: anyerror!Union = Union{ .Color = 1234 }; |
| 10 | try std.testing.expect((union_or_err catch unreachable).Color == 1234); | 13 | try std.testing.expect((union_or_err catch unreachable).Color == 1234); |
| 11 | } | 14 | } |
test/behavior/bugs/2692.zig+5| ... | @@ -1,8 +1,13 @@ | ... | @@ -1,8 +1,13 @@ |
| 1 | const builtin = @import("builtin"); | ||
| 2 | |||
| 1 | fn foo(a: []u8) void { | 3 | fn foo(a: []u8) void { |
| 2 | _ = a; | 4 | _ = a; |
| 3 | } | 5 | } |
| 4 | 6 | ||
| 5 | test "address of 0 length array" { | 7 | test "address of 0 length array" { |
| 8 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 9 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 10 | |||
| 6 | var pt: [0]u8 = undefined; | 11 | var pt: [0]u8 = undefined; |
| 7 | foo(&pt); | 12 | foo(&pt); |
| 8 | } | 13 | } |
test/behavior/bugs/2889.zig+5| ... | @@ -1,4 +1,5 @@ | ... | @@ -1,4 +1,5 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | const builtin = @import("builtin"); | ||
| 2 | 3 | ||
| 3 | const source = "A-"; | 4 | const source = "A-"; |
| 4 | 5 | ||
| ... | @@ -26,6 +27,10 @@ fn parseNote() ?i32 { | ... | @@ -26,6 +27,10 @@ fn parseNote() ?i32 { |
| 26 | } | 27 | } |
| 27 | 28 | ||
| 28 | test "fixed" { | 29 | test "fixed" { |
| 30 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 31 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 32 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 33 | |||
| 29 | const result = parseNote(); | 34 | const result = parseNote(); |
| 30 | try std.testing.expect(result.? == 9); | 35 | try std.testing.expect(result.? == 9); |
| 31 | } | 36 | } |
test/behavior/bugs/3046.zig+5-1| ... | @@ -1,4 +1,5 @@ | ... | @@ -1,4 +1,5 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | const builtin = @import("builtin"); | ||
| 2 | const expect = std.testing.expect; | 3 | const expect = std.testing.expect; |
| 3 | 4 | ||
| 4 | const SomeStruct = struct { | 5 | const SomeStruct = struct { |
| ... | @@ -12,7 +13,10 @@ fn couldFail() anyerror!i32 { | ... | @@ -12,7 +13,10 @@ fn couldFail() anyerror!i32 { |
| 12 | var some_struct: SomeStruct = undefined; | 13 | var some_struct: SomeStruct = undefined; |
| 13 | 14 | ||
| 14 | test "fixed" { | 15 | test "fixed" { |
| 15 | if (@import("builtin").zig_backend == .stage2_c) return error.SkipZigTest; // TODO | 16 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| 17 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 18 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 19 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; | ||
| 16 | 20 | ||
| 17 | some_struct = SomeStruct{ | 21 | some_struct = SomeStruct{ |
| 18 | .field = couldFail() catch @as(i32, 0), | 22 | .field = couldFail() catch @as(i32, 0), |
test/behavior/bugs/3586.zig+5| ... | @@ -1,3 +1,5 @@ | ... | @@ -1,3 +1,5 @@ |
| 1 | const builtin = @import("builtin"); | ||
| 2 | |||
| 1 | const NoteParams = struct {}; | 3 | const NoteParams = struct {}; |
| 2 | 4 | ||
| 3 | const Container = struct { | 5 | const Container = struct { |
| ... | @@ -5,6 +7,9 @@ const Container = struct { | ... | @@ -5,6 +7,9 @@ const Container = struct { |
| 5 | }; | 7 | }; |
| 6 | 8 | ||
| 7 | test "fixed" { | 9 | test "fixed" { |
| 10 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 11 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 12 | |||
| 8 | var ctr = Container{ | 13 | var ctr = Container{ |
| 9 | .params = NoteParams{}, | 14 | .params = NoteParams{}, |
| 10 | }; | 15 | }; |
test/behavior/bugs/4560.zig+4| ... | @@ -1,6 +1,10 @@ | ... | @@ -1,6 +1,10 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | const builtin = @import("builtin"); | ||
| 2 | 3 | ||
| 3 | test "fixed" { | 4 | test "fixed" { |
| 5 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 6 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 7 | |||
| 4 | var s: S = .{ | 8 | var s: S = .{ |
| 5 | .a = 1, | 9 | .a = 1, |
| 6 | .b = .{ | 10 | .b = .{ |
test/behavior/bugs/4954.zig+6| ... | @@ -1,8 +1,14 @@ | ... | @@ -1,8 +1,14 @@ |
| 1 | const builtin = @import("builtin"); | ||
| 2 | |||
| 1 | fn f(buf: []u8) void { | 3 | fn f(buf: []u8) void { |
| 2 | _ = &buf[@sizeOf(u32)]; | 4 | _ = &buf[@sizeOf(u32)]; |
| 3 | } | 5 | } |
| 4 | 6 | ||
| 5 | test "crash" { | 7 | test "crash" { |
| 8 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 9 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 10 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 11 | |||
| 6 | var buf: [4096]u8 = undefined; | 12 | var buf: [4096]u8 = undefined; |
| 7 | f(&buf); | 13 | f(&buf); |
| 8 | } | 14 | } |
test/behavior/bugs/624.zig+4| ... | @@ -1,4 +1,5 @@ | ... | @@ -1,4 +1,5 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | const builtin = @import("builtin"); | ||
| 2 | const expect = std.testing.expect; | 3 | const expect = std.testing.expect; |
| 3 | 4 | ||
| 4 | const TestContext = struct { | 5 | const TestContext = struct { |
| ... | @@ -19,6 +20,9 @@ fn MemoryPool(comptime T: type) type { | ... | @@ -19,6 +20,9 @@ fn MemoryPool(comptime T: type) type { |
| 19 | } | 20 | } |
| 20 | 21 | ||
| 21 | test "foo" { | 22 | test "foo" { |
| 23 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 24 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 25 | |||
| 22 | var allocator = ContextAllocator{ .n = 10 }; | 26 | var allocator = ContextAllocator{ .n = 10 }; |
| 23 | try expect(allocator.n == 10); | 27 | try expect(allocator.n == 10); |
| 24 | } | 28 | } |
test/behavior/bugs/704.zig+5| ... | @@ -1,9 +1,14 @@ | ... | @@ -1,9 +1,14 @@ |
| 1 | const builtin = @import("builtin"); | ||
| 2 | |||
| 1 | const xxx = struct { | 3 | const xxx = struct { |
| 2 | pub fn bar(self: *xxx) void { | 4 | pub fn bar(self: *xxx) void { |
| 3 | _ = self; | 5 | _ = self; |
| 4 | } | 6 | } |
| 5 | }; | 7 | }; |
| 6 | test "bug 704" { | 8 | test "bug 704" { |
| 9 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 10 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 11 | |||
| 7 | var x: xxx = undefined; | 12 | var x: xxx = undefined; |
| 8 | x.bar(); | 13 | x.bar(); |
| 9 | } | 14 | } |
test/behavior/byval_arg_var.zig+5| ... | @@ -1,8 +1,13 @@ | ... | @@ -1,8 +1,13 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | const builtin = @import("builtin"); | ||
| 2 | 3 | ||
| 3 | var result: []const u8 = "wrong"; | 4 | var result: []const u8 = "wrong"; |
| 4 | 5 | ||
| 5 | test "pass string literal byvalue to a generic var param" { | 6 | test "pass string literal byvalue to a generic var param" { |
| 7 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 8 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 9 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 10 | |||
| 6 | start(); | 11 | start(); |
| 7 | blowUpStack(10); | 12 | blowUpStack(10); |
| 8 | 13 |
test/behavior/defer.zig+13| ... | @@ -5,6 +5,9 @@ const expectEqual = std.testing.expectEqual; | ... | @@ -5,6 +5,9 @@ const expectEqual = std.testing.expectEqual; |
| 5 | const expectError = std.testing.expectError; | 5 | const expectError = std.testing.expectError; |
| 6 | 6 | ||
| 7 | test "break and continue inside loop inside defer expression" { | 7 | test "break and continue inside loop inside defer expression" { |
| 8 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 9 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 10 | |||
| 8 | testBreakContInDefer(10); | 11 | testBreakContInDefer(10); |
| 9 | comptime testBreakContInDefer(10); | 12 | comptime testBreakContInDefer(10); |
| 10 | } | 13 | } |
| ... | @@ -21,6 +24,9 @@ fn testBreakContInDefer(x: usize) void { | ... | @@ -21,6 +24,9 @@ fn testBreakContInDefer(x: usize) void { |
| 21 | } | 24 | } |
| 22 | 25 | ||
| 23 | test "defer and labeled break" { | 26 | test "defer and labeled break" { |
| 27 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 28 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 29 | |||
| 24 | var i = @as(usize, 0); | 30 | var i = @as(usize, 0); |
| 25 | 31 | ||
| 26 | blk: { | 32 | blk: { |
| ... | @@ -32,6 +38,9 @@ test "defer and labeled break" { | ... | @@ -32,6 +38,9 @@ test "defer and labeled break" { |
| 32 | } | 38 | } |
| 33 | 39 | ||
| 34 | test "errdefer does not apply to fn inside fn" { | 40 | test "errdefer does not apply to fn inside fn" { |
| 41 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 42 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 43 | |||
| 35 | if (testNestedFnErrDefer()) |_| @panic("expected error") else |e| try expect(e == error.Bad); | 44 | if (testNestedFnErrDefer()) |_| @panic("expected error") else |e| try expect(e == error.Bad); |
| 36 | } | 45 | } |
| 37 | 46 | ||
| ... | @@ -47,6 +56,10 @@ fn testNestedFnErrDefer() anyerror!void { | ... | @@ -47,6 +56,10 @@ fn testNestedFnErrDefer() anyerror!void { |
| 47 | } | 56 | } |
| 48 | 57 | ||
| 49 | test "return variable while defer expression in scope to modify it" { | 58 | test "return variable while defer expression in scope to modify it" { |
| 59 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 60 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 61 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 62 | |||
| 50 | const S = struct { | 63 | const S = struct { |
| 51 | fn doTheTest() !void { | 64 | fn doTheTest() !void { |
| 52 | try expect(notNull().? == 1); | 65 | try expect(notNull().? == 1); |
test/behavior/enum.zig+110| ... | @@ -11,6 +11,9 @@ fn shouldEqual(n: Number, expected: u3) !void { | ... | @@ -11,6 +11,9 @@ fn shouldEqual(n: Number, expected: u3) !void { |
| 11 | } | 11 | } |
| 12 | 12 | ||
| 13 | test "enum to int" { | 13 | test "enum to int" { |
| 14 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 15 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 16 | |||
| 14 | try shouldEqual(Number.Zero, 0); | 17 | try shouldEqual(Number.Zero, 0); |
| 15 | try shouldEqual(Number.One, 1); | 18 | try shouldEqual(Number.One, 1); |
| 16 | try shouldEqual(Number.Two, 2); | 19 | try shouldEqual(Number.Two, 2); |
| ... | @@ -24,6 +27,9 @@ fn testIntToEnumEval(x: i32) !void { | ... | @@ -24,6 +27,9 @@ fn testIntToEnumEval(x: i32) !void { |
| 24 | const IntToEnumNumber = enum { Zero, One, Two, Three, Four }; | 27 | const IntToEnumNumber = enum { Zero, One, Two, Three, Four }; |
| 25 | 28 | ||
| 26 | test "int to enum" { | 29 | test "int to enum" { |
| 30 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 31 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 32 | |||
| 27 | try testIntToEnumEval(3); | 33 | try testIntToEnumEval(3); |
| 28 | } | 34 | } |
| 29 | 35 | ||
| ... | @@ -553,6 +559,9 @@ const ValueCount257 = enum { | ... | @@ -553,6 +559,9 @@ const ValueCount257 = enum { |
| 553 | }; | 559 | }; |
| 554 | 560 | ||
| 555 | test "enum sizes" { | 561 | test "enum sizes" { |
| 562 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 563 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 564 | |||
| 556 | comptime { | 565 | comptime { |
| 557 | try expect(@sizeOf(ValueCount1) == 0); | 566 | try expect(@sizeOf(ValueCount1) == 0); |
| 558 | try expect(@sizeOf(ValueCount2) == 1); | 567 | try expect(@sizeOf(ValueCount2) == 1); |
| ... | @@ -562,6 +571,9 @@ test "enum sizes" { | ... | @@ -562,6 +571,9 @@ test "enum sizes" { |
| 562 | } | 571 | } |
| 563 | 572 | ||
| 564 | test "enum literal equality" { | 573 | test "enum literal equality" { |
| 574 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 575 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 576 | |||
| 565 | const x = .hi; | 577 | const x = .hi; |
| 566 | const y = .ok; | 578 | const y = .ok; |
| 567 | const z = .hi; | 579 | const z = .hi; |
| ... | @@ -571,6 +583,9 @@ test "enum literal equality" { | ... | @@ -571,6 +583,9 @@ test "enum literal equality" { |
| 571 | } | 583 | } |
| 572 | 584 | ||
| 573 | test "enum literal cast to enum" { | 585 | test "enum literal cast to enum" { |
| 586 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 587 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 588 | |||
| 574 | const Color = enum { Auto, Off, On }; | 589 | const Color = enum { Auto, Off, On }; |
| 575 | 590 | ||
| 576 | var color1: Color = .Auto; | 591 | var color1: Color = .Auto; |
| ... | @@ -579,6 +594,9 @@ test "enum literal cast to enum" { | ... | @@ -579,6 +594,9 @@ test "enum literal cast to enum" { |
| 579 | } | 594 | } |
| 580 | 595 | ||
| 581 | test "peer type resolution with enum literal" { | 596 | test "peer type resolution with enum literal" { |
| 597 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 598 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 599 | |||
| 582 | const Items = enum { one, two }; | 600 | const Items = enum { one, two }; |
| 583 | 601 | ||
| 584 | try expect(Items.two == .two); | 602 | try expect(Items.two == .two); |
| ... | @@ -603,11 +621,19 @@ fn testEnumWithSpecifiedTagValues(x: MultipleChoice) !void { | ... | @@ -603,11 +621,19 @@ fn testEnumWithSpecifiedTagValues(x: MultipleChoice) !void { |
| 603 | } | 621 | } |
| 604 | 622 | ||
| 605 | test "enum with specified tag values" { | 623 | test "enum with specified tag values" { |
| 624 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 625 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 626 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 627 | |||
| 606 | try testEnumWithSpecifiedTagValues(MultipleChoice.C); | 628 | try testEnumWithSpecifiedTagValues(MultipleChoice.C); |
| 607 | comptime try testEnumWithSpecifiedTagValues(MultipleChoice.C); | 629 | comptime try testEnumWithSpecifiedTagValues(MultipleChoice.C); |
| 608 | } | 630 | } |
| 609 | 631 | ||
| 610 | test "non-exhaustive enum" { | 632 | test "non-exhaustive enum" { |
| 633 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 634 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 635 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 636 | |||
| 611 | const S = struct { | 637 | const S = struct { |
| 612 | const E = enum(u8) { a, b, _ }; | 638 | const E = enum(u8) { a, b, _ }; |
| 613 | 639 | ||
| ... | @@ -649,6 +675,9 @@ test "non-exhaustive enum" { | ... | @@ -649,6 +675,9 @@ test "non-exhaustive enum" { |
| 649 | } | 675 | } |
| 650 | 676 | ||
| 651 | test "empty non-exhaustive enum" { | 677 | test "empty non-exhaustive enum" { |
| 678 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 679 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 680 | |||
| 652 | const S = struct { | 681 | const S = struct { |
| 653 | const E = enum(u8) { _ }; | 682 | const E = enum(u8) { _ }; |
| 654 | 683 | ||
| ... | @@ -668,6 +697,10 @@ test "empty non-exhaustive enum" { | ... | @@ -668,6 +697,10 @@ test "empty non-exhaustive enum" { |
| 668 | } | 697 | } |
| 669 | 698 | ||
| 670 | test "single field non-exhaustive enum" { | 699 | test "single field non-exhaustive enum" { |
| 700 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 701 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 702 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 703 | |||
| 671 | const S = struct { | 704 | const S = struct { |
| 672 | const E = enum(u8) { a, _ }; | 705 | const E = enum(u8) { a, _ }; |
| 673 | fn doTheTest(y: u8) !void { | 706 | fn doTheTest(y: u8) !void { |
| ... | @@ -708,6 +741,9 @@ const EnumWithTagValues = enum(u4) { | ... | @@ -708,6 +741,9 @@ const EnumWithTagValues = enum(u4) { |
| 708 | D = 1 << 3, | 741 | D = 1 << 3, |
| 709 | }; | 742 | }; |
| 710 | test "enum with tag values don't require parens" { | 743 | test "enum with tag values don't require parens" { |
| 744 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 745 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 746 | |||
| 711 | try expect(@enumToInt(EnumWithTagValues.C) == 0b0100); | 747 | try expect(@enumToInt(EnumWithTagValues.C) == 0b0100); |
| 712 | } | 748 | } |
| 713 | 749 | ||
| ... | @@ -724,11 +760,18 @@ const MultipleChoice2 = enum(u32) { | ... | @@ -724,11 +760,18 @@ const MultipleChoice2 = enum(u32) { |
| 724 | }; | 760 | }; |
| 725 | 761 | ||
| 726 | test "cast integer literal to enum" { | 762 | test "cast integer literal to enum" { |
| 763 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 764 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 765 | |||
| 727 | try expect(@intToEnum(MultipleChoice2, 0) == MultipleChoice2.Unspecified1); | 766 | try expect(@intToEnum(MultipleChoice2, 0) == MultipleChoice2.Unspecified1); |
| 728 | try expect(@intToEnum(MultipleChoice2, 40) == MultipleChoice2.B); | 767 | try expect(@intToEnum(MultipleChoice2, 40) == MultipleChoice2.B); |
| 729 | } | 768 | } |
| 730 | 769 | ||
| 731 | test "enum with specified and unspecified tag values" { | 770 | test "enum with specified and unspecified tag values" { |
| 771 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 772 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 773 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 774 | |||
| 732 | try testEnumWithSpecifiedAndUnspecifiedTagValues(MultipleChoice2.D); | 775 | try testEnumWithSpecifiedAndUnspecifiedTagValues(MultipleChoice2.D); |
| 733 | comptime try testEnumWithSpecifiedAndUnspecifiedTagValues(MultipleChoice2.D); | 776 | comptime try testEnumWithSpecifiedAndUnspecifiedTagValues(MultipleChoice2.D); |
| 734 | } | 777 | } |
| ... | @@ -752,6 +795,9 @@ const Small2 = enum(u2) { One, Two }; | ... | @@ -752,6 +795,9 @@ const Small2 = enum(u2) { One, Two }; |
| 752 | const Small = enum(u2) { One, Two, Three, Four }; | 795 | const Small = enum(u2) { One, Two, Three, Four }; |
| 753 | 796 | ||
| 754 | test "set enum tag type" { | 797 | test "set enum tag type" { |
| 798 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 799 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 800 | |||
| 755 | { | 801 | { |
| 756 | var x = Small.One; | 802 | var x = Small.One; |
| 757 | x = Small.Two; | 803 | x = Small.Two; |
| ... | @@ -765,6 +811,9 @@ test "set enum tag type" { | ... | @@ -765,6 +811,9 @@ test "set enum tag type" { |
| 765 | } | 811 | } |
| 766 | 812 | ||
| 767 | test "casting enum to its tag type" { | 813 | test "casting enum to its tag type" { |
| 814 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 815 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 816 | |||
| 768 | try testCastEnumTag(Small2.Two); | 817 | try testCastEnumTag(Small2.Two); |
| 769 | comptime try testCastEnumTag(Small2.Two); | 818 | comptime try testCastEnumTag(Small2.Two); |
| 770 | } | 819 | } |
| ... | @@ -774,6 +823,9 @@ fn testCastEnumTag(value: Small2) !void { | ... | @@ -774,6 +823,9 @@ fn testCastEnumTag(value: Small2) !void { |
| 774 | } | 823 | } |
| 775 | 824 | ||
| 776 | test "enum with 1 field but explicit tag type should still have the tag type" { | 825 | test "enum with 1 field but explicit tag type should still have the tag type" { |
| 826 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 827 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 828 | |||
| 777 | const Enum = enum(u8) { | 829 | const Enum = enum(u8) { |
| 778 | B = 2, | 830 | B = 2, |
| 779 | }; | 831 | }; |
| ... | @@ -781,6 +833,9 @@ test "enum with 1 field but explicit tag type should still have the tag type" { | ... | @@ -781,6 +833,9 @@ test "enum with 1 field but explicit tag type should still have the tag type" { |
| 781 | } | 833 | } |
| 782 | 834 | ||
| 783 | test "signed integer as enum tag" { | 835 | test "signed integer as enum tag" { |
| 836 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 837 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 838 | |||
| 784 | const SignedEnum = enum(i2) { | 839 | const SignedEnum = enum(i2) { |
| 785 | A0 = -1, | 840 | A0 = -1, |
| 786 | A1 = 0, | 841 | A1 = 0, |
| ... | @@ -793,6 +848,9 @@ test "signed integer as enum tag" { | ... | @@ -793,6 +848,9 @@ test "signed integer as enum tag" { |
| 793 | } | 848 | } |
| 794 | 849 | ||
| 795 | test "enum with one member and custom tag type" { | 850 | test "enum with one member and custom tag type" { |
| 851 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 852 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 853 | |||
| 796 | const E = enum(u2) { | 854 | const E = enum(u2) { |
| 797 | One, | 855 | One, |
| 798 | }; | 856 | }; |
| ... | @@ -804,6 +862,9 @@ test "enum with one member and custom tag type" { | ... | @@ -804,6 +862,9 @@ test "enum with one member and custom tag type" { |
| 804 | } | 862 | } |
| 805 | 863 | ||
| 806 | test "enum with one member and u1 tag type @enumToInt" { | 864 | test "enum with one member and u1 tag type @enumToInt" { |
| 865 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 866 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 867 | |||
| 807 | const Enum = enum(u1) { | 868 | const Enum = enum(u1) { |
| 808 | Test, | 869 | Test, |
| 809 | }; | 870 | }; |
| ... | @@ -811,6 +872,9 @@ test "enum with one member and u1 tag type @enumToInt" { | ... | @@ -811,6 +872,9 @@ test "enum with one member and u1 tag type @enumToInt" { |
| 811 | } | 872 | } |
| 812 | 873 | ||
| 813 | test "enum with comptime_int tag type" { | 874 | test "enum with comptime_int tag type" { |
| 875 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 876 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 877 | |||
| 814 | const Enum = enum(comptime_int) { | 878 | const Enum = enum(comptime_int) { |
| 815 | One = 3, | 879 | One = 3, |
| 816 | Two = 2, | 880 | Two = 2, |
| ... | @@ -820,6 +884,9 @@ test "enum with comptime_int tag type" { | ... | @@ -820,6 +884,9 @@ test "enum with comptime_int tag type" { |
| 820 | } | 884 | } |
| 821 | 885 | ||
| 822 | test "enum with one member default to u0 tag type" { | 886 | test "enum with one member default to u0 tag type" { |
| 887 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 888 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 889 | |||
| 823 | const E0 = enum { X }; | 890 | const E0 = enum { X }; |
| 824 | comptime try expect(Tag(E0) == u0); | 891 | comptime try expect(Tag(E0) == u0); |
| 825 | } | 892 | } |
| ... | @@ -836,11 +903,17 @@ fn doALoopThing(id: EnumWithOneMember) void { | ... | @@ -836,11 +903,17 @@ fn doALoopThing(id: EnumWithOneMember) void { |
| 836 | } | 903 | } |
| 837 | 904 | ||
| 838 | test "comparison operator on enum with one member is comptime known" { | 905 | test "comparison operator on enum with one member is comptime known" { |
| 906 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 907 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 908 | |||
| 839 | doALoopThing(EnumWithOneMember.Eof); | 909 | doALoopThing(EnumWithOneMember.Eof); |
| 840 | } | 910 | } |
| 841 | 911 | ||
| 842 | const State = enum { Start }; | 912 | const State = enum { Start }; |
| 843 | test "switch on enum with one member is comptime known" { | 913 | test "switch on enum with one member is comptime known" { |
| 914 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 915 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 916 | |||
| 844 | var state = State.Start; | 917 | var state = State.Start; |
| 845 | switch (state) { | 918 | switch (state) { |
| 846 | State.Start => return, | 919 | State.Start => return, |
| ... | @@ -849,6 +922,9 @@ test "switch on enum with one member is comptime known" { | ... | @@ -849,6 +922,9 @@ test "switch on enum with one member is comptime known" { |
| 849 | } | 922 | } |
| 850 | 923 | ||
| 851 | test "method call on an enum" { | 924 | test "method call on an enum" { |
| 925 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 926 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 927 | |||
| 852 | const S = struct { | 928 | const S = struct { |
| 853 | const E = enum { | 929 | const E = enum { |
| 854 | one, | 930 | one, |
| ... | @@ -885,6 +961,10 @@ test "enum value allocation" { | ... | @@ -885,6 +961,10 @@ test "enum value allocation" { |
| 885 | } | 961 | } |
| 886 | 962 | ||
| 887 | test "enum literal casting to tagged union" { | 963 | test "enum literal casting to tagged union" { |
| 964 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 965 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 966 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 967 | |||
| 888 | const Arch = union(enum) { | 968 | const Arch = union(enum) { |
| 889 | x86_64, | 969 | x86_64, |
| 890 | arm: Arm32, | 970 | arm: Arm32, |
| ... | @@ -930,6 +1010,11 @@ test "exporting enum type and value" { | ... | @@ -930,6 +1010,11 @@ test "exporting enum type and value" { |
| 930 | } | 1010 | } |
| 931 | 1011 | ||
| 932 | test "constant enum initialization with differing sizes" { | 1012 | test "constant enum initialization with differing sizes" { |
| 1013 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 1014 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 1015 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 1016 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | ||
| 1017 | |||
| 933 | try test3_1(test3_foo); | 1018 | try test3_1(test3_foo); |
| 934 | try test3_2(test3_bar); | 1019 | try test3_2(test3_bar); |
| 935 | } | 1020 | } |
| ... | @@ -970,6 +1055,9 @@ fn test3_2(f: Test3Foo) !void { | ... | @@ -970,6 +1055,9 @@ fn test3_2(f: Test3Foo) !void { |
| 970 | test "@tagName" { | 1055 | test "@tagName" { |
| 971 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO | 1056 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO |
| 972 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | 1057 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO |
| 1058 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 1059 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 1060 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 973 | 1061 | ||
| 974 | try expect(mem.eql(u8, testEnumTagNameBare(BareNumber.Three), "Three")); | 1062 | try expect(mem.eql(u8, testEnumTagNameBare(BareNumber.Three), "Three")); |
| 975 | comptime try expect(mem.eql(u8, testEnumTagNameBare(BareNumber.Three), "Three")); | 1063 | comptime try expect(mem.eql(u8, testEnumTagNameBare(BareNumber.Three), "Three")); |
| ... | @@ -984,6 +1072,9 @@ const BareNumber = enum { One, Two, Three }; | ... | @@ -984,6 +1072,9 @@ const BareNumber = enum { One, Two, Three }; |
| 984 | test "@tagName non-exhaustive enum" { | 1072 | test "@tagName non-exhaustive enum" { |
| 985 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO | 1073 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO |
| 986 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | 1074 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO |
| 1075 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 1076 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 1077 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 987 | 1078 | ||
| 988 | try expect(mem.eql(u8, testEnumTagNameBare(NonExhaustive.B), "B")); | 1079 | try expect(mem.eql(u8, testEnumTagNameBare(NonExhaustive.B), "B")); |
| 989 | comptime try expect(mem.eql(u8, testEnumTagNameBare(NonExhaustive.B), "B")); | 1080 | comptime try expect(mem.eql(u8, testEnumTagNameBare(NonExhaustive.B), "B")); |
| ... | @@ -993,6 +1084,9 @@ const NonExhaustive = enum(u8) { A, B, _ }; | ... | @@ -993,6 +1084,9 @@ const NonExhaustive = enum(u8) { A, B, _ }; |
| 993 | test "@tagName is null-terminated" { | 1084 | test "@tagName is null-terminated" { |
| 994 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO | 1085 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO |
| 995 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | 1086 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO |
| 1087 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 1088 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 1089 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 996 | 1090 | ||
| 997 | const S = struct { | 1091 | const S = struct { |
| 998 | fn doTheTest(n: BareNumber) !void { | 1092 | fn doTheTest(n: BareNumber) !void { |
| ... | @@ -1006,6 +1100,9 @@ test "@tagName is null-terminated" { | ... | @@ -1006,6 +1100,9 @@ test "@tagName is null-terminated" { |
| 1006 | test "tag name with assigned enum values" { | 1100 | test "tag name with assigned enum values" { |
| 1007 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO | 1101 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO |
| 1008 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | 1102 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO |
| 1103 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 1104 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 1105 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 1009 | 1106 | ||
| 1010 | const LocalFoo = enum(u8) { | 1107 | const LocalFoo = enum(u8) { |
| 1011 | A = 1, | 1108 | A = 1, |
| ... | @@ -1016,11 +1113,18 @@ test "tag name with assigned enum values" { | ... | @@ -1016,11 +1113,18 @@ test "tag name with assigned enum values" { |
| 1016 | } | 1113 | } |
| 1017 | 1114 | ||
| 1018 | test "@tagName on enum literals" { | 1115 | test "@tagName on enum literals" { |
| 1116 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 1117 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 1118 | |||
| 1019 | try expect(mem.eql(u8, @tagName(.FooBar), "FooBar")); | 1119 | try expect(mem.eql(u8, @tagName(.FooBar), "FooBar")); |
| 1020 | comptime try expect(mem.eql(u8, @tagName(.FooBar), "FooBar")); | 1120 | comptime try expect(mem.eql(u8, @tagName(.FooBar), "FooBar")); |
| 1021 | } | 1121 | } |
| 1022 | 1122 | ||
| 1023 | test "enum literal casting to optional" { | 1123 | test "enum literal casting to optional" { |
| 1124 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 1125 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 1126 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 1127 | |||
| 1024 | var bar: ?Bar = undefined; | 1128 | var bar: ?Bar = undefined; |
| 1025 | bar = .B; | 1129 | bar = .B; |
| 1026 | 1130 | ||
| ... | @@ -1045,6 +1149,9 @@ const bit_field_1 = BitFieldOfEnums{ | ... | @@ -1045,6 +1149,9 @@ const bit_field_1 = BitFieldOfEnums{ |
| 1045 | 1149 | ||
| 1046 | test "bit field access with enum fields" { | 1150 | test "bit field access with enum fields" { |
| 1047 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | 1151 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO |
| 1152 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 1153 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 1154 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 1048 | 1155 | ||
| 1049 | var data = bit_field_1; | 1156 | var data = bit_field_1; |
| 1050 | try expect(getA(&data) == A.Two); | 1157 | try expect(getA(&data) == A.Two); |
| ... | @@ -1073,6 +1180,9 @@ fn getC(data: *const BitFieldOfEnums) C { | ... | @@ -1073,6 +1180,9 @@ fn getC(data: *const BitFieldOfEnums) C { |
| 1073 | } | 1180 | } |
| 1074 | 1181 | ||
| 1075 | test "enum literal in array literal" { | 1182 | test "enum literal in array literal" { |
| 1183 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 1184 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 1185 | |||
| 1076 | const Items = enum { one, two }; | 1186 | const Items = enum { one, two }; |
| 1077 | const array = [_]Items{ .one, .two }; | 1187 | const array = [_]Items{ .one, .two }; |
| 1078 | 1188 |
test/behavior/error.zig+48| ... | @@ -6,12 +6,18 @@ const expectEqual = std.testing.expectEqual; | ... | @@ -6,12 +6,18 @@ const expectEqual = std.testing.expectEqual; |
| 6 | const mem = std.mem; | 6 | const mem = std.mem; |
| 7 | 7 | ||
| 8 | test "error values" { | 8 | test "error values" { |
| 9 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 10 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 11 | |||
| 9 | const a = @errorToInt(error.err1); | 12 | const a = @errorToInt(error.err1); |
| 10 | const b = @errorToInt(error.err2); | 13 | const b = @errorToInt(error.err2); |
| 11 | try expect(a != b); | 14 | try expect(a != b); |
| 12 | } | 15 | } |
| 13 | 16 | ||
| 14 | test "redefinition of error values allowed" { | 17 | test "redefinition of error values allowed" { |
| 18 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 19 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 20 | |||
| 15 | shouldBeNotEqual(error.AnError, error.SecondError); | 21 | shouldBeNotEqual(error.AnError, error.SecondError); |
| 16 | } | 22 | } |
| 17 | fn shouldBeNotEqual(a: anyerror, b: anyerror) void { | 23 | fn shouldBeNotEqual(a: anyerror, b: anyerror) void { |
| ... | @@ -19,6 +25,10 @@ fn shouldBeNotEqual(a: anyerror, b: anyerror) void { | ... | @@ -19,6 +25,10 @@ fn shouldBeNotEqual(a: anyerror, b: anyerror) void { |
| 19 | } | 25 | } |
| 20 | 26 | ||
| 21 | test "error binary operator" { | 27 | test "error binary operator" { |
| 28 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 29 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 30 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 31 | |||
| 22 | const a = errBinaryOperatorG(true) catch 3; | 32 | const a = errBinaryOperatorG(true) catch 3; |
| 23 | const b = errBinaryOperatorG(false) catch 3; | 33 | const b = errBinaryOperatorG(false) catch 3; |
| 24 | try expect(a == 3); | 34 | try expect(a == 3); |
| ... | @@ -29,6 +39,9 @@ fn errBinaryOperatorG(x: bool) anyerror!isize { | ... | @@ -29,6 +39,9 @@ fn errBinaryOperatorG(x: bool) anyerror!isize { |
| 29 | } | 39 | } |
| 30 | 40 | ||
| 31 | test "empty error union" { | 41 | test "empty error union" { |
| 42 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 43 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 44 | |||
| 32 | const x = error{} || error{}; | 45 | const x = error{} || error{}; |
| 33 | _ = x; | 46 | _ = x; |
| 34 | } | 47 | } |
| ... | @@ -48,10 +61,18 @@ pub fn baz() anyerror!i32 { | ... | @@ -48,10 +61,18 @@ pub fn baz() anyerror!i32 { |
| 48 | } | 61 | } |
| 49 | 62 | ||
| 50 | test "error wrapping" { | 63 | test "error wrapping" { |
| 64 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 65 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 66 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 67 | |||
| 51 | try expect((baz() catch unreachable) == 15); | 68 | try expect((baz() catch unreachable) == 15); |
| 52 | } | 69 | } |
| 53 | 70 | ||
| 54 | test "unwrap simple value from error" { | 71 | test "unwrap simple value from error" { |
| 72 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 73 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 74 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 75 | |||
| 55 | const i = unwrapSimpleValueFromErrorDo() catch unreachable; | 76 | const i = unwrapSimpleValueFromErrorDo() catch unreachable; |
| 56 | try expect(i == 13); | 77 | try expect(i == 13); |
| 57 | } | 78 | } |
| ... | @@ -60,6 +81,10 @@ fn unwrapSimpleValueFromErrorDo() anyerror!isize { | ... | @@ -60,6 +81,10 @@ fn unwrapSimpleValueFromErrorDo() anyerror!isize { |
| 60 | } | 81 | } |
| 61 | 82 | ||
| 62 | test "error return in assignment" { | 83 | test "error return in assignment" { |
| 84 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 85 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 86 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 87 | |||
| 63 | doErrReturnInAssignment() catch unreachable; | 88 | doErrReturnInAssignment() catch unreachable; |
| 64 | } | 89 | } |
| 65 | 90 | ||
| ... | @@ -73,12 +98,19 @@ fn makeANonErr() anyerror!i32 { | ... | @@ -73,12 +98,19 @@ fn makeANonErr() anyerror!i32 { |
| 73 | } | 98 | } |
| 74 | 99 | ||
| 75 | test "syntax: optional operator in front of error union operator" { | 100 | test "syntax: optional operator in front of error union operator" { |
| 101 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 102 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 103 | |||
| 76 | comptime { | 104 | comptime { |
| 77 | try expect(?(anyerror!i32) == ?(anyerror!i32)); | 105 | try expect(?(anyerror!i32) == ?(anyerror!i32)); |
| 78 | } | 106 | } |
| 79 | } | 107 | } |
| 80 | 108 | ||
| 81 | test "widen cast integer payload of error union function call" { | 109 | test "widen cast integer payload of error union function call" { |
| 110 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 111 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 112 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 113 | |||
| 82 | const S = struct { | 114 | const S = struct { |
| 83 | fn errorable() !u64 { | 115 | fn errorable() !u64 { |
| 84 | var x = @as(u64, try number()); | 116 | var x = @as(u64, try number()); |
| ... | @@ -93,12 +125,19 @@ test "widen cast integer payload of error union function call" { | ... | @@ -93,12 +125,19 @@ test "widen cast integer payload of error union function call" { |
| 93 | } | 125 | } |
| 94 | 126 | ||
| 95 | test "debug info for optional error set" { | 127 | test "debug info for optional error set" { |
| 128 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 129 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 130 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 131 | |||
| 96 | const SomeError = error{Hello}; | 132 | const SomeError = error{Hello}; |
| 97 | var a_local_variable: ?SomeError = null; | 133 | var a_local_variable: ?SomeError = null; |
| 98 | _ = a_local_variable; | 134 | _ = a_local_variable; |
| 99 | } | 135 | } |
| 100 | 136 | ||
| 101 | test "implicit cast to optional to error union to return result loc" { | 137 | test "implicit cast to optional to error union to return result loc" { |
| 138 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 139 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 140 | |||
| 102 | const S = struct { | 141 | const S = struct { |
| 103 | fn entry() !void { | 142 | fn entry() !void { |
| 104 | var x: Foo = undefined; | 143 | var x: Foo = undefined; |
| ... | @@ -118,6 +157,9 @@ test "implicit cast to optional to error union to return result loc" { | ... | @@ -118,6 +157,9 @@ test "implicit cast to optional to error union to return result loc" { |
| 118 | } | 157 | } |
| 119 | 158 | ||
| 120 | test "error: fn returning empty error set can be passed as fn returning any error" { | 159 | test "error: fn returning empty error set can be passed as fn returning any error" { |
| 160 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 161 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 162 | |||
| 121 | entry(); | 163 | entry(); |
| 122 | comptime entry(); | 164 | comptime entry(); |
| 123 | } | 165 | } |
| ... | @@ -482,6 +524,9 @@ test "error union comptime caching" { | ... | @@ -482,6 +524,9 @@ test "error union comptime caching" { |
| 482 | test "@errorName" { | 524 | test "@errorName" { |
| 483 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO | 525 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO |
| 484 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | 526 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO |
| 527 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 528 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 529 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 485 | 530 | ||
| 486 | try expect(mem.eql(u8, @errorName(error.AnError), "AnError")); | 531 | try expect(mem.eql(u8, @errorName(error.AnError), "AnError")); |
| 487 | try expect(mem.eql(u8, @errorName(error.ALongerErrorName), "ALongerErrorName")); | 532 | try expect(mem.eql(u8, @errorName(error.ALongerErrorName), "ALongerErrorName")); |
| ... | @@ -494,6 +539,9 @@ fn gimmeItBroke() anyerror { | ... | @@ -494,6 +539,9 @@ fn gimmeItBroke() anyerror { |
| 494 | test "@errorName sentinel length matches slice length" { | 539 | test "@errorName sentinel length matches slice length" { |
| 495 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO | 540 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO |
| 496 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | 541 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO |
| 542 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 543 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 544 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 497 | 545 | ||
| 498 | const name = testBuiltinErrorName(error.FooBar); | 546 | const name = testBuiltinErrorName(error.FooBar); |
| 499 | const length: usize = 6; | 547 | const length: usize = 6; |
test/behavior/fn.zig+71| ... | @@ -5,6 +5,9 @@ const expect = testing.expect; | ... | @@ -5,6 +5,9 @@ const expect = testing.expect; |
| 5 | const expectEqual = testing.expectEqual; | 5 | const expectEqual = testing.expectEqual; |
| 6 | 6 | ||
| 7 | test "params" { | 7 | test "params" { |
| 8 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 9 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 10 | |||
| 8 | try expect(testParamsAdd(22, 11) == 33); | 11 | try expect(testParamsAdd(22, 11) == 33); |
| 9 | } | 12 | } |
| 10 | fn testParamsAdd(a: i32, b: i32) i32 { | 13 | fn testParamsAdd(a: i32, b: i32) i32 { |
| ... | @@ -12,6 +15,9 @@ fn testParamsAdd(a: i32, b: i32) i32 { | ... | @@ -12,6 +15,9 @@ fn testParamsAdd(a: i32, b: i32) i32 { |
| 12 | } | 15 | } |
| 13 | 16 | ||
| 14 | test "local variables" { | 17 | test "local variables" { |
| 18 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 19 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 20 | |||
| 15 | testLocVars(2); | 21 | testLocVars(2); |
| 16 | } | 22 | } |
| 17 | fn testLocVars(b: i32) void { | 23 | fn testLocVars(b: i32) void { |
| ... | @@ -20,6 +26,9 @@ fn testLocVars(b: i32) void { | ... | @@ -20,6 +26,9 @@ fn testLocVars(b: i32) void { |
| 20 | } | 26 | } |
| 21 | 27 | ||
| 22 | test "mutable local variables" { | 28 | test "mutable local variables" { |
| 29 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 30 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 31 | |||
| 23 | var zero: i32 = 0; | 32 | var zero: i32 = 0; |
| 24 | try expect(zero == 0); | 33 | try expect(zero == 0); |
| 25 | 34 | ||
| ... | @@ -31,6 +40,9 @@ test "mutable local variables" { | ... | @@ -31,6 +40,9 @@ test "mutable local variables" { |
| 31 | } | 40 | } |
| 32 | 41 | ||
| 33 | test "separate block scopes" { | 42 | test "separate block scopes" { |
| 43 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 44 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 45 | |||
| 34 | { | 46 | { |
| 35 | const no_conflict: i32 = 5; | 47 | const no_conflict: i32 = 5; |
| 36 | try expect(no_conflict == 5); | 48 | try expect(no_conflict == 5); |
| ... | @@ -47,10 +59,16 @@ fn @"weird function name"() i32 { | ... | @@ -47,10 +59,16 @@ fn @"weird function name"() i32 { |
| 47 | return 1234; | 59 | return 1234; |
| 48 | } | 60 | } |
| 49 | test "weird function name" { | 61 | test "weird function name" { |
| 62 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 63 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 64 | |||
| 50 | try expect(@"weird function name"() == 1234); | 65 | try expect(@"weird function name"() == 1234); |
| 51 | } | 66 | } |
| 52 | 67 | ||
| 53 | test "assign inline fn to const variable" { | 68 | test "assign inline fn to const variable" { |
| 69 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 70 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 71 | |||
| 54 | const a = inlineFn; | 72 | const a = inlineFn; |
| 55 | a(); | 73 | a(); |
| 56 | } | 74 | } |
| ... | @@ -68,6 +86,9 @@ fn outer(y: u32) *const fn (u32) u32 { | ... | @@ -68,6 +86,9 @@ fn outer(y: u32) *const fn (u32) u32 { |
| 68 | } | 86 | } |
| 69 | 87 | ||
| 70 | test "return inner function which references comptime variable of outer function" { | 88 | test "return inner function which references comptime variable of outer function" { |
| 89 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 90 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 91 | |||
| 71 | if (builtin.zig_backend == .stage1) return error.SkipZigTest; | 92 | if (builtin.zig_backend == .stage1) return error.SkipZigTest; |
| 72 | 93 | ||
| 73 | var func = outer(10); | 94 | var func = outer(10); |
| ... | @@ -76,6 +97,9 @@ test "return inner function which references comptime variable of outer function | ... | @@ -76,6 +97,9 @@ test "return inner function which references comptime variable of outer function |
| 76 | 97 | ||
| 77 | test "discard the result of a function that returns a struct" { | 98 | test "discard the result of a function that returns a struct" { |
| 78 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO | 99 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO |
| 100 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 101 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 102 | |||
| 79 | const S = struct { | 103 | const S = struct { |
| 80 | fn entry() void { | 104 | fn entry() void { |
| 81 | _ = func(); | 105 | _ = func(); |
| ... | @@ -97,6 +121,9 @@ test "discard the result of a function that returns a struct" { | ... | @@ -97,6 +121,9 @@ test "discard the result of a function that returns a struct" { |
| 97 | test "inline function call that calls optional function pointer, return pointer at callsite interacts correctly with callsite return type" { | 121 | test "inline function call that calls optional function pointer, return pointer at callsite interacts correctly with callsite return type" { |
| 98 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO | 122 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO |
| 99 | if (builtin.zig_backend == .stage1) return error.SkipZigTest; | 123 | if (builtin.zig_backend == .stage1) return error.SkipZigTest; |
| 124 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 125 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 126 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 100 | 127 | ||
| 101 | const S = struct { | 128 | const S = struct { |
| 102 | field: u32, | 129 | field: u32, |
| ... | @@ -129,6 +156,9 @@ test "inline function call that calls optional function pointer, return pointer | ... | @@ -129,6 +156,9 @@ test "inline function call that calls optional function pointer, return pointer |
| 129 | } | 156 | } |
| 130 | 157 | ||
| 131 | test "implicit cast function unreachable return" { | 158 | test "implicit cast function unreachable return" { |
| 159 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 160 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 161 | |||
| 132 | wantsFnWithVoid(fnWithUnreachable); | 162 | wantsFnWithVoid(fnWithUnreachable); |
| 133 | } | 163 | } |
| 134 | 164 | ||
| ... | @@ -143,6 +173,8 @@ fn fnWithUnreachable() noreturn { | ... | @@ -143,6 +173,8 @@ fn fnWithUnreachable() noreturn { |
| 143 | test "extern struct with stdcallcc fn pointer" { | 173 | test "extern struct with stdcallcc fn pointer" { |
| 144 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO | 174 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO |
| 145 | if (builtin.zig_backend == .stage1) return error.SkipZigTest; | 175 | if (builtin.zig_backend == .stage1) return error.SkipZigTest; |
| 176 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 177 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 146 | 178 | ||
| 147 | const S = extern struct { | 179 | const S = extern struct { |
| 148 | ptr: *const fn () callconv(if (builtin.target.cpu.arch == .i386) .Stdcall else .C) i32, | 180 | ptr: *const fn () callconv(if (builtin.target.cpu.arch == .i386) .Stdcall else .C) i32, |
| ... | @@ -170,10 +202,16 @@ fn fComplexCallconvRet(x: u32) callconv(blk: { | ... | @@ -170,10 +202,16 @@ fn fComplexCallconvRet(x: u32) callconv(blk: { |
| 170 | } | 202 | } |
| 171 | 203 | ||
| 172 | test "function with complex callconv and return type expressions" { | 204 | test "function with complex callconv and return type expressions" { |
| 205 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 206 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 207 | |||
| 173 | try expect(fComplexCallconvRet(3).x == 9); | 208 | try expect(fComplexCallconvRet(3).x == 9); |
| 174 | } | 209 | } |
| 175 | 210 | ||
| 176 | test "pass by non-copying value" { | 211 | test "pass by non-copying value" { |
| 212 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 213 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 214 | |||
| 177 | try expect(addPointCoords(Point{ .x = 1, .y = 2 }) == 3); | 215 | try expect(addPointCoords(Point{ .x = 1, .y = 2 }) == 3); |
| 178 | } | 216 | } |
| 179 | 217 | ||
| ... | @@ -187,6 +225,10 @@ fn addPointCoords(pt: Point) i32 { | ... | @@ -187,6 +225,10 @@ fn addPointCoords(pt: Point) i32 { |
| 187 | } | 225 | } |
| 188 | 226 | ||
| 189 | test "pass by non-copying value through var arg" { | 227 | test "pass by non-copying value through var arg" { |
| 228 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 229 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 230 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 231 | |||
| 190 | try expect((try addPointCoordsVar(Point{ .x = 1, .y = 2 })) == 3); | 232 | try expect((try addPointCoordsVar(Point{ .x = 1, .y = 2 })) == 3); |
| 191 | } | 233 | } |
| 192 | 234 | ||
| ... | @@ -196,6 +238,9 @@ fn addPointCoordsVar(pt: anytype) !i32 { | ... | @@ -196,6 +238,9 @@ fn addPointCoordsVar(pt: anytype) !i32 { |
| 196 | } | 238 | } |
| 197 | 239 | ||
| 198 | test "pass by non-copying value as method" { | 240 | test "pass by non-copying value as method" { |
| 241 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 242 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 243 | |||
| 199 | var pt = Point2{ .x = 1, .y = 2 }; | 244 | var pt = Point2{ .x = 1, .y = 2 }; |
| 200 | try expect(pt.addPointCoords() == 3); | 245 | try expect(pt.addPointCoords() == 3); |
| 201 | } | 246 | } |
| ... | @@ -210,6 +255,9 @@ const Point2 = struct { | ... | @@ -210,6 +255,9 @@ const Point2 = struct { |
| 210 | }; | 255 | }; |
| 211 | 256 | ||
| 212 | test "pass by non-copying value as method, which is generic" { | 257 | test "pass by non-copying value as method, which is generic" { |
| 258 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 259 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 260 | |||
| 213 | var pt = Point3{ .x = 1, .y = 2 }; | 261 | var pt = Point3{ .x = 1, .y = 2 }; |
| 214 | try expect(pt.addPointCoords(i32) == 3); | 262 | try expect(pt.addPointCoords(i32) == 3); |
| 215 | } | 263 | } |
| ... | @@ -225,6 +273,9 @@ const Point3 = struct { | ... | @@ -225,6 +273,9 @@ const Point3 = struct { |
| 225 | }; | 273 | }; |
| 226 | 274 | ||
| 227 | test "pass by non-copying value as method, at comptime" { | 275 | test "pass by non-copying value as method, at comptime" { |
| 276 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 277 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 278 | |||
| 228 | comptime { | 279 | comptime { |
| 229 | var pt = Point2{ .x = 1, .y = 2 }; | 280 | var pt = Point2{ .x = 1, .y = 2 }; |
| 230 | try expect(pt.addPointCoords() == 3); | 281 | try expect(pt.addPointCoords() == 3); |
| ... | @@ -232,6 +283,9 @@ test "pass by non-copying value as method, at comptime" { | ... | @@ -232,6 +283,9 @@ test "pass by non-copying value as method, at comptime" { |
| 232 | } | 283 | } |
| 233 | 284 | ||
| 234 | test "implicit cast fn call result to optional in field result" { | 285 | test "implicit cast fn call result to optional in field result" { |
| 286 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 287 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 288 | |||
| 235 | const S = struct { | 289 | const S = struct { |
| 236 | fn entry() !void { | 290 | fn entry() !void { |
| 237 | var x = Foo{ | 291 | var x = Foo{ |
| ... | @@ -255,6 +309,10 @@ test "implicit cast fn call result to optional in field result" { | ... | @@ -255,6 +309,10 @@ test "implicit cast fn call result to optional in field result" { |
| 255 | } | 309 | } |
| 256 | 310 | ||
| 257 | test "void parameters" { | 311 | test "void parameters" { |
| 312 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 313 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 314 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 315 | |||
| 258 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO | 316 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO |
| 259 | try voidFun(1, void{}, 2, {}); | 317 | try voidFun(1, void{}, 2, {}); |
| 260 | } | 318 | } |
| ... | @@ -267,6 +325,9 @@ fn voidFun(a: i32, b: void, c: i32, d: void) !void { | ... | @@ -267,6 +325,9 @@ fn voidFun(a: i32, b: void, c: i32, d: void) !void { |
| 267 | } | 325 | } |
| 268 | 326 | ||
| 269 | test "call function with empty string" { | 327 | test "call function with empty string" { |
| 328 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 329 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 330 | |||
| 270 | acceptsString(""); | 331 | acceptsString(""); |
| 271 | } | 332 | } |
| 272 | 333 | ||
| ... | @@ -301,6 +362,9 @@ fn fn4() u32 { | ... | @@ -301,6 +362,9 @@ fn fn4() u32 { |
| 301 | } | 362 | } |
| 302 | 363 | ||
| 303 | test "number literal as an argument" { | 364 | test "number literal as an argument" { |
| 365 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 366 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 367 | |||
| 304 | try numberLiteralArg(3); | 368 | try numberLiteralArg(3); |
| 305 | comptime try numberLiteralArg(3); | 369 | comptime try numberLiteralArg(3); |
| 306 | } | 370 | } |
| ... | @@ -311,6 +375,10 @@ fn numberLiteralArg(a: anytype) !void { | ... | @@ -311,6 +375,10 @@ fn numberLiteralArg(a: anytype) !void { |
| 311 | 375 | ||
| 312 | test "function call with anon list literal" { | 376 | test "function call with anon list literal" { |
| 313 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO | 377 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO |
| 378 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 379 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 380 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 381 | |||
| 314 | const S = struct { | 382 | const S = struct { |
| 315 | fn doTheTest() !void { | 383 | fn doTheTest() !void { |
| 316 | try consumeVec(.{ 9, 8, 7 }); | 384 | try consumeVec(.{ 9, 8, 7 }); |
| ... | @@ -327,6 +395,9 @@ test "function call with anon list literal" { | ... | @@ -327,6 +395,9 @@ test "function call with anon list literal" { |
| 327 | } | 395 | } |
| 328 | 396 | ||
| 329 | test "ability to give comptime types and non comptime types to same parameter" { | 397 | test "ability to give comptime types and non comptime types to same parameter" { |
| 398 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 399 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 400 | |||
| 330 | const S = struct { | 401 | const S = struct { |
| 331 | fn doTheTest() !void { | 402 | fn doTheTest() !void { |
| 332 | var x: i32 = 1; | 403 | var x: i32 = 1; |
test/behavior/for.zig+23-1| ... | @@ -5,6 +5,9 @@ const expectEqual = std.testing.expectEqual; | ... | @@ -5,6 +5,9 @@ const expectEqual = std.testing.expectEqual; |
| 5 | const mem = std.mem; | 5 | const mem = std.mem; |
| 6 | 6 | ||
| 7 | test "continue in for loop" { | 7 | test "continue in for loop" { |
| 8 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 9 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 10 | |||
| 8 | const array = [_]i32{ 1, 2, 3, 4, 5 }; | 11 | const array = [_]i32{ 1, 2, 3, 4, 5 }; |
| 9 | var sum: i32 = 0; | 12 | var sum: i32 = 0; |
| 10 | for (array) |x| { | 13 | for (array) |x| { |
| ... | @@ -18,6 +21,9 @@ test "continue in for loop" { | ... | @@ -18,6 +21,9 @@ test "continue in for loop" { |
| 18 | } | 21 | } |
| 19 | 22 | ||
| 20 | test "break from outer for loop" { | 23 | test "break from outer for loop" { |
| 24 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 25 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 26 | |||
| 21 | try testBreakOuter(); | 27 | try testBreakOuter(); |
| 22 | comptime try testBreakOuter(); | 28 | comptime try testBreakOuter(); |
| 23 | } | 29 | } |
| ... | @@ -35,6 +41,9 @@ fn testBreakOuter() !void { | ... | @@ -35,6 +41,9 @@ fn testBreakOuter() !void { |
| 35 | } | 41 | } |
| 36 | 42 | ||
| 37 | test "continue outer for loop" { | 43 | test "continue outer for loop" { |
| 44 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 45 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 46 | |||
| 38 | try testContinueOuter(); | 47 | try testContinueOuter(); |
| 39 | comptime try testContinueOuter(); | 48 | comptime try testContinueOuter(); |
| 40 | } | 49 | } |
| ... | @@ -52,6 +61,9 @@ fn testContinueOuter() !void { | ... | @@ -52,6 +61,9 @@ fn testContinueOuter() !void { |
| 52 | } | 61 | } |
| 53 | 62 | ||
| 54 | test "ignore lval with underscore (for loop)" { | 63 | test "ignore lval with underscore (for loop)" { |
| 64 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 65 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 66 | |||
| 55 | for ([_]void{}) |_, i| { | 67 | for ([_]void{}) |_, i| { |
| 56 | _ = i; | 68 | _ = i; |
| 57 | for ([_]void{}) |_, j| { | 69 | for ([_]void{}) |_, j| { |
| ... | @@ -63,7 +75,10 @@ test "ignore lval with underscore (for loop)" { | ... | @@ -63,7 +75,10 @@ test "ignore lval with underscore (for loop)" { |
| 63 | } | 75 | } |
| 64 | 76 | ||
| 65 | test "basic for loop" { | 77 | test "basic for loop" { |
| 66 | if (@import("builtin").zig_backend == .stage2_c) return error.SkipZigTest; // TODO | 78 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO |
| 79 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 80 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 81 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 67 | 82 | ||
| 68 | const expected_result = [_]u8{ 9, 8, 7, 6, 0, 1, 2, 3 } ** 3; | 83 | const expected_result = [_]u8{ 9, 8, 7, 6, 0, 1, 2, 3 } ** 3; |
| 69 | 84 | ||
| ... | @@ -104,6 +119,10 @@ test "basic for loop" { | ... | @@ -104,6 +119,10 @@ test "basic for loop" { |
| 104 | } | 119 | } |
| 105 | 120 | ||
| 106 | test "for with null and T peer types and inferred result location type" { | 121 | test "for with null and T peer types and inferred result location type" { |
| 122 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 123 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 124 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 125 | |||
| 107 | const S = struct { | 126 | const S = struct { |
| 108 | fn doTheTest(slice: []const u8) !void { | 127 | fn doTheTest(slice: []const u8) !void { |
| 109 | if (for (slice) |item| { | 128 | if (for (slice) |item| { |
| ... | @@ -121,6 +140,9 @@ test "for with null and T peer types and inferred result location type" { | ... | @@ -121,6 +140,9 @@ test "for with null and T peer types and inferred result location type" { |
| 121 | } | 140 | } |
| 122 | 141 | ||
| 123 | test "2 break statements and an else" { | 142 | test "2 break statements and an else" { |
| 143 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 144 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 145 | |||
| 124 | const S = struct { | 146 | const S = struct { |
| 125 | fn entry(t: bool, f: bool) !void { | 147 | fn entry(t: bool, f: bool) !void { |
| 126 | var buf: [10]u8 = undefined; | 148 | var buf: [10]u8 = undefined; |
test/behavior/generics.zig+41-2| ... | @@ -5,6 +5,9 @@ const expect = testing.expect; | ... | @@ -5,6 +5,9 @@ const expect = testing.expect; |
| 5 | const expectEqual = testing.expectEqual; | 5 | const expectEqual = testing.expectEqual; |
| 6 | 6 | ||
| 7 | test "one param, explicit comptime" { | 7 | test "one param, explicit comptime" { |
| 8 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 9 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 10 | |||
| 8 | var x: usize = 0; | 11 | var x: usize = 0; |
| 9 | x += checkSize(i32); | 12 | x += checkSize(i32); |
| 10 | x += checkSize(bool); | 13 | x += checkSize(bool); |
| ... | @@ -17,6 +20,9 @@ fn checkSize(comptime T: type) usize { | ... | @@ -17,6 +20,9 @@ fn checkSize(comptime T: type) usize { |
| 17 | } | 20 | } |
| 18 | 21 | ||
| 19 | test "simple generic fn" { | 22 | test "simple generic fn" { |
| 23 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 24 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 25 | |||
| 20 | try expect(max(i32, 3, -1) == 3); | 26 | try expect(max(i32, 3, -1) == 3); |
| 21 | try expect(max(u8, 1, 100) == 100); | 27 | try expect(max(u8, 1, 100) == 100); |
| 22 | if (builtin.zig_backend == .stage1) { | 28 | if (builtin.zig_backend == .stage1) { |
| ... | @@ -37,6 +43,9 @@ fn add(comptime a: i32, b: i32) i32 { | ... | @@ -37,6 +43,9 @@ fn add(comptime a: i32, b: i32) i32 { |
| 37 | 43 | ||
| 38 | const the_max = max(u32, 1234, 5678); | 44 | const the_max = max(u32, 1234, 5678); |
| 39 | test "compile time generic eval" { | 45 | test "compile time generic eval" { |
| 46 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 47 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 48 | |||
| 40 | try expect(the_max == 5678); | 49 | try expect(the_max == 5678); |
| 41 | } | 50 | } |
| 42 | 51 | ||
| ... | @@ -53,12 +62,20 @@ fn sameButWithFloats(a: f64, b: f64) f64 { | ... | @@ -53,12 +62,20 @@ fn sameButWithFloats(a: f64, b: f64) f64 { |
| 53 | } | 62 | } |
| 54 | 63 | ||
| 55 | test "fn with comptime args" { | 64 | test "fn with comptime args" { |
| 65 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 66 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 67 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 68 | |||
| 56 | try expect(gimmeTheBigOne(1234, 5678) == 5678); | 69 | try expect(gimmeTheBigOne(1234, 5678) == 5678); |
| 57 | try expect(shouldCallSameInstance(34, 12) == 34); | 70 | try expect(shouldCallSameInstance(34, 12) == 34); |
| 58 | try expect(sameButWithFloats(0.43, 0.49) == 0.49); | 71 | try expect(sameButWithFloats(0.43, 0.49) == 0.49); |
| 59 | } | 72 | } |
| 60 | 73 | ||
| 61 | test "anytype params" { | 74 | test "anytype params" { |
| 75 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 76 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 77 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 78 | |||
| 62 | try expect(max_i32(12, 34) == 34); | 79 | try expect(max_i32(12, 34) == 34); |
| 63 | try expect(max_f64(1.2, 3.4) == 3.4); | 80 | try expect(max_f64(1.2, 3.4) == 3.4); |
| 64 | comptime { | 81 | comptime { |
| ... | @@ -80,6 +97,10 @@ fn max_f64(a: f64, b: f64) f64 { | ... | @@ -80,6 +97,10 @@ fn max_f64(a: f64, b: f64) f64 { |
| 80 | } | 97 | } |
| 81 | 98 | ||
| 82 | test "type constructed by comptime function call" { | 99 | test "type constructed by comptime function call" { |
| 100 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 101 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 102 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 103 | |||
| 83 | var l: SimpleList(10) = undefined; | 104 | var l: SimpleList(10) = undefined; |
| 84 | l.array[0] = 10; | 105 | l.array[0] = 10; |
| 85 | l.array[1] = 11; | 106 | l.array[1] = 11; |
| ... | @@ -99,6 +120,9 @@ fn SimpleList(comptime L: usize) type { | ... | @@ -99,6 +120,9 @@ fn SimpleList(comptime L: usize) type { |
| 99 | } | 120 | } |
| 100 | 121 | ||
| 101 | test "function with return type type" { | 122 | test "function with return type type" { |
| 123 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 124 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 125 | |||
| 102 | var list: List(i32) = undefined; | 126 | var list: List(i32) = undefined; |
| 103 | var list2: List(i32) = undefined; | 127 | var list2: List(i32) = undefined; |
| 104 | list.length = 10; | 128 | list.length = 10; |
| ... | @@ -120,6 +144,9 @@ pub fn SmallList(comptime T: type, comptime STATIC_SIZE: usize) type { | ... | @@ -120,6 +144,9 @@ pub fn SmallList(comptime T: type, comptime STATIC_SIZE: usize) type { |
| 120 | } | 144 | } |
| 121 | 145 | ||
| 122 | test "const decls in struct" { | 146 | test "const decls in struct" { |
| 147 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 148 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 149 | |||
| 123 | try expect(GenericDataThing(3).count_plus_one == 4); | 150 | try expect(GenericDataThing(3).count_plus_one == 4); |
| 124 | } | 151 | } |
| 125 | fn GenericDataThing(comptime count: isize) type { | 152 | fn GenericDataThing(comptime count: isize) type { |
| ... | @@ -129,6 +156,9 @@ fn GenericDataThing(comptime count: isize) type { | ... | @@ -129,6 +156,9 @@ fn GenericDataThing(comptime count: isize) type { |
| 129 | } | 156 | } |
| 130 | 157 | ||
| 131 | test "use generic param in generic param" { | 158 | test "use generic param in generic param" { |
| 159 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 160 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 161 | |||
| 132 | try expect(aGenericFn(i32, 3, 4) == 7); | 162 | try expect(aGenericFn(i32, 3, 4) == 7); |
| 133 | } | 163 | } |
| 134 | fn aGenericFn(comptime T: type, comptime a: T, b: T) T { | 164 | fn aGenericFn(comptime T: type, comptime a: T, b: T) T { |
| ... | @@ -136,6 +166,9 @@ fn aGenericFn(comptime T: type, comptime a: T, b: T) T { | ... | @@ -136,6 +166,9 @@ fn aGenericFn(comptime T: type, comptime a: T, b: T) T { |
| 136 | } | 166 | } |
| 137 | 167 | ||
| 138 | test "generic fn with implicit cast" { | 168 | test "generic fn with implicit cast" { |
| 169 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 170 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 171 | |||
| 139 | try expect(getFirstByte(u8, &[_]u8{13}) == 13); | 172 | try expect(getFirstByte(u8, &[_]u8{13}) == 13); |
| 140 | try expect(getFirstByte(u16, &[_]u16{ | 173 | try expect(getFirstByte(u16, &[_]u16{ |
| 141 | 0, | 174 | 0, |
| ... | @@ -150,6 +183,9 @@ fn getFirstByte(comptime T: type, mem: []const T) u8 { | ... | @@ -150,6 +183,9 @@ fn getFirstByte(comptime T: type, mem: []const T) u8 { |
| 150 | } | 183 | } |
| 151 | 184 | ||
| 152 | test "generic fn keeps non-generic parameter types" { | 185 | test "generic fn keeps non-generic parameter types" { |
| 186 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 187 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 188 | |||
| 153 | const A = 128; | 189 | const A = 128; |
| 154 | 190 | ||
| 155 | const S = struct { | 191 | const S = struct { |
| ... | @@ -165,8 +201,10 @@ test "generic fn keeps non-generic parameter types" { | ... | @@ -165,8 +201,10 @@ test "generic fn keeps non-generic parameter types" { |
| 165 | } | 201 | } |
| 166 | 202 | ||
| 167 | test "array of generic fns" { | 203 | test "array of generic fns" { |
| 204 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 205 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 168 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; | 206 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; |
| 169 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | 207 | |
| 170 | try expect(foos[0](true)); | 208 | try expect(foos[0](true)); |
| 171 | try expect(!foos[1](true)); | 209 | try expect(!foos[1](true)); |
| 172 | } | 210 | } |
| ... | @@ -185,7 +223,8 @@ fn foo2(arg: anytype) bool { | ... | @@ -185,7 +223,8 @@ fn foo2(arg: anytype) bool { |
| 185 | 223 | ||
| 186 | test "generic struct" { | 224 | test "generic struct" { |
| 187 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; | 225 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; |
| 188 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | 226 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 227 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 189 | var a1 = GenNode(i32){ | 228 | var a1 = GenNode(i32){ |
| 190 | .value = 13, | 229 | .value = 13, |
| 191 | .next = null, | 230 | .next = null, |
test/behavior/if.zig+20| ... | @@ -4,6 +4,9 @@ const expect = std.testing.expect; | ... | @@ -4,6 +4,9 @@ const expect = std.testing.expect; |
| 4 | const expectEqual = std.testing.expectEqual; | 4 | const expectEqual = std.testing.expectEqual; |
| 5 | 5 | ||
| 6 | test "if statements" { | 6 | test "if statements" { |
| 7 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 8 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 9 | |||
| 7 | shouldBeEqual(1, 1); | 10 | shouldBeEqual(1, 1); |
| 8 | firstEqlThird(2, 1, 2); | 11 | firstEqlThird(2, 1, 2); |
| 9 | } | 12 | } |
| ... | @@ -27,6 +30,9 @@ fn firstEqlThird(a: i32, b: i32, c: i32) void { | ... | @@ -27,6 +30,9 @@ fn firstEqlThird(a: i32, b: i32, c: i32) void { |
| 27 | } | 30 | } |
| 28 | 31 | ||
| 29 | test "else if expression" { | 32 | test "else if expression" { |
| 33 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 34 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 35 | |||
| 30 | try expect(elseIfExpressionF(1) == 1); | 36 | try expect(elseIfExpressionF(1) == 1); |
| 31 | } | 37 | } |
| 32 | fn elseIfExpressionF(c: u8) u8 { | 38 | fn elseIfExpressionF(c: u8) u8 { |
| ... | @@ -44,6 +50,10 @@ var global_with_val: anyerror!u32 = 0; | ... | @@ -44,6 +50,10 @@ var global_with_val: anyerror!u32 = 0; |
| 44 | var global_with_err: anyerror!u32 = error.SomeError; | 50 | var global_with_err: anyerror!u32 = error.SomeError; |
| 45 | 51 | ||
| 46 | test "unwrap mutable global var" { | 52 | test "unwrap mutable global var" { |
| 53 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 54 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 55 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 56 | |||
| 47 | if (global_with_val) |v| { | 57 | if (global_with_val) |v| { |
| 48 | try expect(v == 0); | 58 | try expect(v == 0); |
| 49 | } else |_| { | 59 | } else |_| { |
| ... | @@ -57,6 +67,9 @@ test "unwrap mutable global var" { | ... | @@ -57,6 +67,9 @@ test "unwrap mutable global var" { |
| 57 | } | 67 | } |
| 58 | 68 | ||
| 59 | test "labeled break inside comptime if inside runtime if" { | 69 | test "labeled break inside comptime if inside runtime if" { |
| 70 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 71 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 72 | |||
| 60 | var answer: i32 = 0; | 73 | var answer: i32 = 0; |
| 61 | var c = true; | 74 | var c = true; |
| 62 | if (c) { | 75 | if (c) { |
| ... | @@ -68,6 +81,9 @@ test "labeled break inside comptime if inside runtime if" { | ... | @@ -68,6 +81,9 @@ test "labeled break inside comptime if inside runtime if" { |
| 68 | } | 81 | } |
| 69 | 82 | ||
| 70 | test "const result loc, runtime if cond, else unreachable" { | 83 | test "const result loc, runtime if cond, else unreachable" { |
| 84 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 85 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 86 | |||
| 71 | const Num = enum { One, Two }; | 87 | const Num = enum { One, Two }; |
| 72 | 88 | ||
| 73 | var t = true; | 89 | var t = true; |
| ... | @@ -76,6 +92,10 @@ test "const result loc, runtime if cond, else unreachable" { | ... | @@ -76,6 +92,10 @@ test "const result loc, runtime if cond, else unreachable" { |
| 76 | } | 92 | } |
| 77 | 93 | ||
| 78 | test "if copies its payload" { | 94 | test "if copies its payload" { |
| 95 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 96 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 97 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 98 | |||
| 79 | const S = struct { | 99 | const S = struct { |
| 80 | fn doTheTest() !void { | 100 | fn doTheTest() !void { |
| 81 | var tmp: ?i32 = 10; | 101 | var tmp: ?i32 = 10; |
test/behavior/incomplete_struct_param_tld.zig+3| ... | @@ -1,3 +1,4 @@ | ... | @@ -1,3 +1,4 @@ |
| 1 | const builtin = @import("builtin"); | ||
| 1 | const expect = @import("std").testing.expect; | 2 | const expect = @import("std").testing.expect; |
| 2 | 3 | ||
| 3 | const A = struct { | 4 | const A = struct { |
| ... | @@ -21,6 +22,8 @@ fn foo(a: A) i32 { | ... | @@ -21,6 +22,8 @@ fn foo(a: A) i32 { |
| 21 | } | 22 | } |
| 22 | 23 | ||
| 23 | test "incomplete struct param top level declaration" { | 24 | test "incomplete struct param top level declaration" { |
| 25 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 26 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 24 | const a = A{ | 27 | const a = A{ |
| 25 | .b = B{ | 28 | .b = B{ |
| 26 | .c = C{ .x = 13 }, | 29 | .c = C{ .x = 13 }, |
test/behavior/inttoptr.zig+6| ... | @@ -3,6 +3,8 @@ const builtin = @import("builtin"); | ... | @@ -3,6 +3,8 @@ const builtin = @import("builtin"); |
| 3 | test "casting integer address to function pointer" { | 3 | test "casting integer address to function pointer" { |
| 4 | if (builtin.zig_backend == .stage1) return error.SkipZigTest; | 4 | if (builtin.zig_backend == .stage1) return error.SkipZigTest; |
| 5 | if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .aarch64) return error.SkipZigTest; // TODO | 5 | if (builtin.zig_backend == .stage2_llvm and builtin.cpu.arch == .aarch64) return error.SkipZigTest; // TODO |
| 6 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 7 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 6 | 8 | ||
| 7 | addressToFunction(); | 9 | addressToFunction(); |
| 8 | comptime addressToFunction(); | 10 | comptime addressToFunction(); |
| ... | @@ -14,6 +16,10 @@ fn addressToFunction() void { | ... | @@ -14,6 +16,10 @@ fn addressToFunction() void { |
| 14 | } | 16 | } |
| 15 | 17 | ||
| 16 | test "mutate through ptr initialized with constant intToPtr value" { | 18 | test "mutate through ptr initialized with constant intToPtr value" { |
| 19 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 20 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 21 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 22 | |||
| 17 | forceCompilerAnalyzeBranchHardCodedPtrDereference(false); | 23 | forceCompilerAnalyzeBranchHardCodedPtrDereference(false); |
| 18 | } | 24 | } |
| 19 | 25 |
test/behavior/member_func.zig+6| ... | @@ -28,6 +28,9 @@ const HasFuncs = struct { | ... | @@ -28,6 +28,9 @@ const HasFuncs = struct { |
| 28 | 28 | ||
| 29 | test "standard field calls" { | 29 | test "standard field calls" { |
| 30 | if (builtin.zig_backend == .stage1) return error.SkipZigTest; | 30 | if (builtin.zig_backend == .stage1) return error.SkipZigTest; |
| 31 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 32 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 33 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 31 | 34 | ||
| 32 | try expect(HasFuncs.one(0) == 1); | 35 | try expect(HasFuncs.one(0) == 1); |
| 33 | try expect(HasFuncs.two(0) == 2); | 36 | try expect(HasFuncs.two(0) == 2); |
| ... | @@ -69,6 +72,9 @@ test "standard field calls" { | ... | @@ -69,6 +72,9 @@ test "standard field calls" { |
| 69 | 72 | ||
| 70 | test "@field field calls" { | 73 | test "@field field calls" { |
| 71 | if (builtin.zig_backend == .stage1) return error.SkipZigTest; | 74 | if (builtin.zig_backend == .stage1) return error.SkipZigTest; |
| 75 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 76 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 77 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 72 | 78 | ||
| 73 | try expect(@field(HasFuncs, "one")(0) == 1); | 79 | try expect(@field(HasFuncs, "one")(0) == 1); |
| 74 | try expect(@field(HasFuncs, "two")(0) == 2); | 80 | try expect(@field(HasFuncs, "two")(0) == 2); |
test/behavior/null.zig+29| ... | @@ -29,6 +29,10 @@ test "optional type" { | ... | @@ -29,6 +29,10 @@ test "optional type" { |
| 29 | } | 29 | } |
| 30 | 30 | ||
| 31 | test "test maybe object and get a pointer to the inner value" { | 31 | test "test maybe object and get a pointer to the inner value" { |
| 32 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 33 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 34 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 35 | |||
| 32 | var maybe_bool: ?bool = true; | 36 | var maybe_bool: ?bool = true; |
| 33 | 37 | ||
| 34 | if (maybe_bool) |*b| { | 38 | if (maybe_bool) |*b| { |
| ... | @@ -45,6 +49,10 @@ test "rhs maybe unwrap return" { | ... | @@ -45,6 +49,10 @@ test "rhs maybe unwrap return" { |
| 45 | } | 49 | } |
| 46 | 50 | ||
| 47 | test "maybe return" { | 51 | test "maybe return" { |
| 52 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 53 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 54 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 55 | |||
| 48 | try maybeReturnImpl(); | 56 | try maybeReturnImpl(); |
| 49 | comptime try maybeReturnImpl(); | 57 | comptime try maybeReturnImpl(); |
| 50 | } | 58 | } |
| ... | @@ -61,6 +69,10 @@ fn foo(x: ?i32) ?bool { | ... | @@ -61,6 +69,10 @@ fn foo(x: ?i32) ?bool { |
| 61 | } | 69 | } |
| 62 | 70 | ||
| 63 | test "test null runtime" { | 71 | test "test null runtime" { |
| 72 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 73 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 74 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 75 | |||
| 64 | try testTestNullRuntime(null); | 76 | try testTestNullRuntime(null); |
| 65 | } | 77 | } |
| 66 | fn testTestNullRuntime(x: ?i32) !void { | 78 | fn testTestNullRuntime(x: ?i32) !void { |
| ... | @@ -69,6 +81,9 @@ fn testTestNullRuntime(x: ?i32) !void { | ... | @@ -69,6 +81,9 @@ fn testTestNullRuntime(x: ?i32) !void { |
| 69 | } | 81 | } |
| 70 | 82 | ||
| 71 | test "optional void" { | 83 | test "optional void" { |
| 84 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 85 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 86 | |||
| 72 | try optionalVoidImpl(); | 87 | try optionalVoidImpl(); |
| 73 | comptime try optionalVoidImpl(); | 88 | comptime try optionalVoidImpl(); |
| 74 | } | 89 | } |
| ... | @@ -89,6 +104,9 @@ fn bar(x: ?void) ?void { | ... | @@ -89,6 +104,9 @@ fn bar(x: ?void) ?void { |
| 89 | const Empty = struct {}; | 104 | const Empty = struct {}; |
| 90 | 105 | ||
| 91 | test "optional struct{}" { | 106 | test "optional struct{}" { |
| 107 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 108 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 109 | |||
| 92 | _ = try optionalEmptyStructImpl(); | 110 | _ = try optionalEmptyStructImpl(); |
| 93 | _ = comptime try optionalEmptyStructImpl(); | 111 | _ = comptime try optionalEmptyStructImpl(); |
| 94 | } | 112 | } |
| ... | @@ -107,17 +125,25 @@ fn baz(x: ?Empty) ?Empty { | ... | @@ -107,17 +125,25 @@ fn baz(x: ?Empty) ?Empty { |
| 107 | } | 125 | } |
| 108 | 126 | ||
| 109 | test "null with default unwrap" { | 127 | test "null with default unwrap" { |
| 128 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 129 | |||
| 110 | const x: i32 = null orelse 1; | 130 | const x: i32 = null orelse 1; |
| 111 | try expect(x == 1); | 131 | try expect(x == 1); |
| 112 | } | 132 | } |
| 113 | 133 | ||
| 114 | test "optional pointer to 0 bit type null value at runtime" { | 134 | test "optional pointer to 0 bit type null value at runtime" { |
| 135 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 136 | |||
| 115 | const EmptyStruct = struct {}; | 137 | const EmptyStruct = struct {}; |
| 116 | var x: ?*EmptyStruct = null; | 138 | var x: ?*EmptyStruct = null; |
| 117 | try expect(x == null); | 139 | try expect(x == null); |
| 118 | } | 140 | } |
| 119 | 141 | ||
| 120 | test "if var maybe pointer" { | 142 | test "if var maybe pointer" { |
| 143 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 144 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 145 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 146 | |||
| 121 | try expect(shouldBeAPlus1(Particle{ | 147 | try expect(shouldBeAPlus1(Particle{ |
| 122 | .a = 14, | 148 | .a = 14, |
| 123 | .b = 1, | 149 | .b = 1, |
| ... | @@ -159,6 +185,9 @@ const here_is_a_null_literal = SillyStruct{ .context = null }; | ... | @@ -159,6 +185,9 @@ const here_is_a_null_literal = SillyStruct{ .context = null }; |
| 159 | test "unwrap optional which is field of global var" { | 185 | test "unwrap optional which is field of global var" { |
| 160 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO | 186 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO |
| 161 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | 187 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO |
| 188 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 189 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 190 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 162 | 191 | ||
| 163 | struct_with_optional.field = null; | 192 | struct_with_optional.field = null; |
| 164 | if (struct_with_optional.field) |payload| { | 193 | if (struct_with_optional.field) |payload| { |
test/behavior/pointers.zig+19| ... | @@ -17,6 +17,10 @@ fn testDerefPtr() !void { | ... | @@ -17,6 +17,10 @@ fn testDerefPtr() !void { |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | test "pointer arithmetic" { | 19 | test "pointer arithmetic" { |
| 20 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 21 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 22 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 23 | |||
| 20 | var ptr: [*]const u8 = "abcd"; | 24 | var ptr: [*]const u8 = "abcd"; |
| 21 | 25 | ||
| 22 | try expect(ptr[0] == 'a'); | 26 | try expect(ptr[0] == 'a'); |
| ... | @@ -61,6 +65,10 @@ test "initialize const optional C pointer to null" { | ... | @@ -61,6 +65,10 @@ test "initialize const optional C pointer to null" { |
| 61 | } | 65 | } |
| 62 | 66 | ||
| 63 | test "assigning integer to C pointer" { | 67 | test "assigning integer to C pointer" { |
| 68 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 69 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 70 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 71 | |||
| 64 | var x: i32 = 0; | 72 | var x: i32 = 0; |
| 65 | var y: i32 = 1; | 73 | var y: i32 = 1; |
| 66 | var ptr: [*c]u8 = 0; | 74 | var ptr: [*c]u8 = 0; |
| ... | @@ -75,6 +83,10 @@ test "assigning integer to C pointer" { | ... | @@ -75,6 +83,10 @@ test "assigning integer to C pointer" { |
| 75 | } | 83 | } |
| 76 | 84 | ||
| 77 | test "C pointer comparison and arithmetic" { | 85 | test "C pointer comparison and arithmetic" { |
| 86 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 87 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 88 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 89 | |||
| 78 | const S = struct { | 90 | const S = struct { |
| 79 | fn doTheTest() !void { | 91 | fn doTheTest() !void { |
| 80 | var ptr1: [*c]u32 = 0; | 92 | var ptr1: [*c]u32 = 0; |
| ... | @@ -133,6 +145,10 @@ test "peer type resolution with C pointers" { | ... | @@ -133,6 +145,10 @@ test "peer type resolution with C pointers" { |
| 133 | } | 145 | } |
| 134 | 146 | ||
| 135 | test "implicit casting between C pointer and optional non-C pointer" { | 147 | test "implicit casting between C pointer and optional non-C pointer" { |
| 148 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 149 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 150 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 151 | |||
| 136 | var slice: []const u8 = "aoeu"; | 152 | var slice: []const u8 = "aoeu"; |
| 137 | const opt_many_ptr: ?[*]const u8 = slice.ptr; | 153 | const opt_many_ptr: ?[*]const u8 = slice.ptr; |
| 138 | var ptr_opt_many_ptr = &opt_many_ptr; | 154 | var ptr_opt_many_ptr = &opt_many_ptr; |
| ... | @@ -172,6 +188,9 @@ test "compare equality of optional and non-optional pointer" { | ... | @@ -172,6 +188,9 @@ test "compare equality of optional and non-optional pointer" { |
| 172 | test "allowzero pointer and slice" { | 188 | test "allowzero pointer and slice" { |
| 173 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO | 189 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO |
| 174 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | 190 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO |
| 191 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 192 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 193 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 175 | 194 | ||
| 176 | var ptr = @intToPtr([*]allowzero i32, 0); | 195 | var ptr = @intToPtr([*]allowzero i32, 0); |
| 177 | var opt_ptr: ?[*]allowzero i32 = ptr; | 196 | var opt_ptr: ?[*]allowzero i32 = ptr; |
test/behavior/ref_var_in_if_after_if_2nd_switch_prong.zig+5| ... | @@ -1,9 +1,14 @@ | ... | @@ -1,9 +1,14 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | const builtin = @import("builtin"); | ||
| 2 | const expect = std.testing.expect; | 3 | const expect = std.testing.expect; |
| 3 | const mem = std.mem; | 4 | const mem = std.mem; |
| 4 | 5 | ||
| 5 | var ok: bool = false; | 6 | var ok: bool = false; |
| 6 | test "reference a variable in an if after an if in the 2nd switch prong" { | 7 | test "reference a variable in an if after an if in the 2nd switch prong" { |
| 8 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 9 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 10 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 11 | |||
| 7 | try foo(true, Num.Two, false, "aoeu"); | 12 | try foo(true, Num.Two, false, "aoeu"); |
| 8 | try expect(!ok); | 13 | try expect(!ok); |
| 9 | try foo(false, Num.One, false, "aoeu"); | 14 | try foo(false, Num.One, false, "aoeu"); |
test/behavior/slice.zig-1| ... | @@ -248,7 +248,6 @@ test "result location zero sized array inside struct field implicit cast to slic | ... | @@ -248,7 +248,6 @@ test "result location zero sized array inside struct field implicit cast to slic |
| 248 | test "runtime safety lets us slice from len..len" { | 248 | test "runtime safety lets us slice from len..len" { |
| 249 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | 249 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 250 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | 250 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; |
| 251 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 252 | 251 | ||
| 253 | var an_array = [_]u8{ 1, 2, 3 }; | 252 | var an_array = [_]u8{ 1, 2, 3 }; |
| 254 | try expect(mem.eql(u8, sliceFromLenToLen(an_array[0..], 3, 3), "")); | 253 | try expect(mem.eql(u8, sliceFromLenToLen(an_array[0..], 3, 3), "")); |
test/behavior/src.zig+3| ... | @@ -1,7 +1,10 @@ | ... | @@ -1,7 +1,10 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | const builtin = @import("builtin"); | ||
| 2 | const expect = std.testing.expect; | 3 | const expect = std.testing.expect; |
| 3 | 4 | ||
| 4 | test "@src" { | 5 | test "@src" { |
| 6 | if (builtin.zig_backend != .stage1) return error.SkipZigTest; | ||
| 7 | |||
| 5 | try doTheTest(); | 8 | try doTheTest(); |
| 6 | } | 9 | } |
| 7 | 10 |
test/behavior/struct.zig+4-8| ... | @@ -86,7 +86,8 @@ const StructFoo = struct { | ... | @@ -86,7 +86,8 @@ const StructFoo = struct { |
| 86 | 86 | ||
| 87 | test "structs" { | 87 | test "structs" { |
| 88 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | 88 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 89 | if (builtin.zig_backend == .stage2_x86_64 or builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | 89 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| 90 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 90 | 91 | ||
| 91 | var foo: StructFoo = undefined; | 92 | var foo: StructFoo = undefined; |
| 92 | @memset(@ptrCast([*]u8, &foo), 0, @sizeOf(StructFoo)); | 93 | @memset(@ptrCast([*]u8, &foo), 0, @sizeOf(StructFoo)); |
| ... | @@ -248,7 +249,8 @@ test "usingnamespace within struct scope" { | ... | @@ -248,7 +249,8 @@ test "usingnamespace within struct scope" { |
| 248 | 249 | ||
| 249 | test "struct field init with catch" { | 250 | test "struct field init with catch" { |
| 250 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | 251 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; |
| 251 | if (builtin.zig_backend == .stage2_x86_64 or builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | 252 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; |
| 253 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 252 | 254 | ||
| 253 | const S = struct { | 255 | const S = struct { |
| 254 | fn doTheTest() !void { | 256 | fn doTheTest() !void { |
| ... | @@ -310,7 +312,6 @@ test "struct point to self" { | ... | @@ -310,7 +312,6 @@ test "struct point to self" { |
| 310 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | 312 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO |
| 311 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO | 313 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO |
| 312 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | 314 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 313 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO | ||
| 314 | 315 | ||
| 315 | var root: Node = undefined; | 316 | var root: Node = undefined; |
| 316 | root.val.x = 1; | 317 | root.val.x = 1; |
| ... | @@ -350,7 +351,6 @@ test "return empty struct from fn" { | ... | @@ -350,7 +351,6 @@ test "return empty struct from fn" { |
| 350 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | 351 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO |
| 351 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO | 352 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO |
| 352 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | 353 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 353 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO | ||
| 354 | 354 | ||
| 355 | _ = testReturnEmptyStructFromFn(); | 355 | _ = testReturnEmptyStructFromFn(); |
| 356 | } | 356 | } |
| ... | @@ -364,7 +364,6 @@ test "pass slice of empty struct to fn" { | ... | @@ -364,7 +364,6 @@ test "pass slice of empty struct to fn" { |
| 364 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | 364 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO |
| 365 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO | 365 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO |
| 366 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | 366 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 367 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO | ||
| 368 | 367 | ||
| 369 | try expect(testPassSliceOfEmptyStructToFn(&[_]EmptyStruct2{EmptyStruct2{}}) == 1); | 368 | try expect(testPassSliceOfEmptyStructToFn(&[_]EmptyStruct2{EmptyStruct2{}}) == 1); |
| 370 | } | 369 | } |
| ... | @@ -409,7 +408,6 @@ test "align 1 field before self referential align 8 field as slice return type" | ... | @@ -409,7 +408,6 @@ test "align 1 field before self referential align 8 field as slice return type" |
| 409 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | 408 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO |
| 410 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO | 409 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO |
| 411 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | 410 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 412 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO | ||
| 413 | 411 | ||
| 414 | const result = alloc(Expr); | 412 | const result = alloc(Expr); |
| 415 | try expect(result.len == 0); | 413 | try expect(result.len == 0); |
| ... | @@ -670,7 +668,6 @@ test "default struct initialization fields" { | ... | @@ -670,7 +668,6 @@ test "default struct initialization fields" { |
| 670 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | 668 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO |
| 671 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO | 669 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO |
| 672 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | 670 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 673 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO | ||
| 674 | 671 | ||
| 675 | const S = struct { | 672 | const S = struct { |
| 676 | a: i32 = 1234, | 673 | a: i32 = 1234, |
| ... | @@ -936,7 +933,6 @@ test "anonymous struct literal syntax" { | ... | @@ -936,7 +933,6 @@ test "anonymous struct literal syntax" { |
| 936 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | 933 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO |
| 937 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO | 934 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO |
| 938 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO | 935 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO |
| 939 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; // TODO | ||
| 940 | 936 | ||
| 941 | const S = struct { | 937 | const S = struct { |
| 942 | const Point = struct { | 938 | const Point = struct { |
test/behavior/this.zig+7| ... | @@ -1,4 +1,5 @@ | ... | @@ -1,4 +1,5 @@ |
| 1 | const expect = @import("std").testing.expect; | 1 | const expect = @import("std").testing.expect; |
| 2 | const builtin = @import("builtin"); | ||
| 2 | 3 | ||
| 3 | const module = @This(); | 4 | const module = @This(); |
| 4 | 5 | ||
| ... | @@ -20,10 +21,16 @@ fn add(x: i32, y: i32) i32 { | ... | @@ -20,10 +21,16 @@ fn add(x: i32, y: i32) i32 { |
| 20 | } | 21 | } |
| 21 | 22 | ||
| 22 | test "this refer to module call private fn" { | 23 | test "this refer to module call private fn" { |
| 24 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 25 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 26 | |||
| 23 | try expect(module.add(1, 2) == 3); | 27 | try expect(module.add(1, 2) == 3); |
| 24 | } | 28 | } |
| 25 | 29 | ||
| 26 | test "this refer to container" { | 30 | test "this refer to container" { |
| 31 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 32 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 33 | |||
| 27 | var pt: Point(i32) = undefined; | 34 | var pt: Point(i32) = undefined; |
| 28 | pt.x = 12; | 35 | pt.x = 12; |
| 29 | pt.y = 34; | 36 | pt.y = 34; |
test/behavior/try.zig+13-1| ... | @@ -1,6 +1,12 @@ | ... | @@ -1,6 +1,12 @@ |
| 1 | const expect = @import("std").testing.expect; | 1 | const std = @import("std"); |
| 2 | const builtin = @import("builtin"); | ||
| 3 | const expect = std.testing.expect; | ||
| 2 | 4 | ||
| 3 | test "try on error union" { | 5 | test "try on error union" { |
| 6 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 7 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 8 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 9 | |||
| 4 | try tryOnErrorUnionImpl(); | 10 | try tryOnErrorUnionImpl(); |
| 5 | comptime try tryOnErrorUnionImpl(); | 11 | comptime try tryOnErrorUnionImpl(); |
| 6 | } | 12 | } |
| ... | @@ -19,6 +25,9 @@ fn returnsTen() anyerror!i32 { | ... | @@ -19,6 +25,9 @@ fn returnsTen() anyerror!i32 { |
| 19 | } | 25 | } |
| 20 | 26 | ||
| 21 | test "try without vars" { | 27 | test "try without vars" { |
| 28 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 29 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 30 | |||
| 22 | const result1 = if (failIfTrue(true)) 1 else |_| @as(i32, 2); | 31 | const result1 = if (failIfTrue(true)) 1 else |_| @as(i32, 2); |
| 23 | try expect(result1 == 2); | 32 | try expect(result1 == 2); |
| 24 | 33 | ||
| ... | @@ -35,6 +44,9 @@ fn failIfTrue(ok: bool) anyerror!void { | ... | @@ -35,6 +44,9 @@ fn failIfTrue(ok: bool) anyerror!void { |
| 35 | } | 44 | } |
| 36 | 45 | ||
| 37 | test "try then not executed with assignment" { | 46 | test "try then not executed with assignment" { |
| 47 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 48 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 49 | |||
| 38 | if (failIfTrue(true)) { | 50 | if (failIfTrue(true)) { |
| 39 | unreachable; | 51 | unreachable; |
| 40 | } else |err| { | 52 | } else |err| { |
test/behavior/type_info.zig+11| ... | @@ -186,6 +186,10 @@ fn testErrorSet() !void { | ... | @@ -186,6 +186,10 @@ fn testErrorSet() !void { |
| 186 | } | 186 | } |
| 187 | 187 | ||
| 188 | test "type info: enum info" { | 188 | test "type info: enum info" { |
| 189 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 190 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 191 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 192 | |||
| 189 | try testEnum(); | 193 | try testEnum(); |
| 190 | comptime try testEnum(); | 194 | comptime try testEnum(); |
| 191 | } | 195 | } |
| ... | @@ -249,6 +253,9 @@ fn testUnion() !void { | ... | @@ -249,6 +253,9 @@ fn testUnion() !void { |
| 249 | } | 253 | } |
| 250 | 254 | ||
| 251 | test "type info: struct info" { | 255 | test "type info: struct info" { |
| 256 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 257 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 258 | |||
| 252 | try testStruct(); | 259 | try testStruct(); |
| 253 | comptime try testStruct(); | 260 | comptime try testStruct(); |
| 254 | } | 261 | } |
| ... | @@ -439,6 +446,10 @@ test "type info for async frames" { | ... | @@ -439,6 +446,10 @@ test "type info for async frames" { |
| 439 | } | 446 | } |
| 440 | 447 | ||
| 441 | test "Declarations are returned in declaration order" { | 448 | test "Declarations are returned in declaration order" { |
| 449 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 450 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 451 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 452 | |||
| 442 | const S = struct { | 453 | const S = struct { |
| 443 | const a = 1; | 454 | const a = 1; |
| 444 | const b = 2; | 455 | const b = 2; |
test/behavior/undefined.zig+11| ... | @@ -16,6 +16,8 @@ test "init static array to undefined" { | ... | @@ -16,6 +16,8 @@ test "init static array to undefined" { |
| 16 | // This test causes `initStaticArray()` to be codegen'd, and the | 16 | // This test causes `initStaticArray()` to be codegen'd, and the |
| 17 | // C backend does not yet support returning arrays, so it fails | 17 | // C backend does not yet support returning arrays, so it fails |
| 18 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; | 18 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; |
| 19 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 20 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 19 | 21 | ||
| 20 | try expect(static_array[0] == 1); | 22 | try expect(static_array[0] == 1); |
| 21 | try expect(static_array[4] == 2); | 23 | try expect(static_array[4] == 2); |
| ... | @@ -43,6 +45,9 @@ fn setFooX(foo: *Foo) void { | ... | @@ -43,6 +45,9 @@ fn setFooX(foo: *Foo) void { |
| 43 | } | 45 | } |
| 44 | 46 | ||
| 45 | test "assign undefined to struct" { | 47 | test "assign undefined to struct" { |
| 48 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 49 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 50 | |||
| 46 | comptime { | 51 | comptime { |
| 47 | var foo: Foo = undefined; | 52 | var foo: Foo = undefined; |
| 48 | setFooX(&foo); | 53 | setFooX(&foo); |
| ... | @@ -56,6 +61,9 @@ test "assign undefined to struct" { | ... | @@ -56,6 +61,9 @@ test "assign undefined to struct" { |
| 56 | } | 61 | } |
| 57 | 62 | ||
| 58 | test "assign undefined to struct with method" { | 63 | test "assign undefined to struct with method" { |
| 64 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 65 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 66 | |||
| 59 | comptime { | 67 | comptime { |
| 60 | var foo: Foo = undefined; | 68 | var foo: Foo = undefined; |
| 61 | foo.setFooXMethod(); | 69 | foo.setFooXMethod(); |
| ... | @@ -69,6 +77,9 @@ test "assign undefined to struct with method" { | ... | @@ -69,6 +77,9 @@ test "assign undefined to struct with method" { |
| 69 | } | 77 | } |
| 70 | 78 | ||
| 71 | test "type name of undefined" { | 79 | test "type name of undefined" { |
| 80 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 81 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 82 | |||
| 72 | const x = undefined; | 83 | const x = undefined; |
| 73 | try expect(mem.eql(u8, @typeName(@TypeOf(x)), "@Type(.Undefined)")); | 84 | try expect(mem.eql(u8, @typeName(@TypeOf(x)), "@Type(.Undefined)")); |
| 74 | } | 85 | } |
test/behavior/underscore.zig+5| ... | @@ -1,4 +1,5 @@ | ... | @@ -1,4 +1,5 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | const builtin = @import("builtin"); | ||
| 2 | const expect = std.testing.expect; | 3 | const expect = std.testing.expect; |
| 3 | 4 | ||
| 4 | test "ignore lval with underscore" { | 5 | test "ignore lval with underscore" { |
| ... | @@ -6,6 +7,10 @@ test "ignore lval with underscore" { | ... | @@ -6,6 +7,10 @@ test "ignore lval with underscore" { |
| 6 | } | 7 | } |
| 7 | 8 | ||
| 8 | test "ignore lval with underscore (while loop)" { | 9 | test "ignore lval with underscore (while loop)" { |
| 10 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 11 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 12 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 13 | |||
| 9 | while (optionalReturnError()) |_| { | 14 | while (optionalReturnError()) |_| { |
| 10 | while (optionalReturnError()) |_| { | 15 | while (optionalReturnError()) |_| { |
| 11 | break; | 16 | break; |
test/behavior/union.zig+139| ... | @@ -10,6 +10,10 @@ const Foo = union { | ... | @@ -10,6 +10,10 @@ const Foo = union { |
| 10 | }; | 10 | }; |
| 11 | 11 | ||
| 12 | test "basic unions" { | 12 | test "basic unions" { |
| 13 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 14 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 15 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 16 | |||
| 13 | var foo = Foo{ .int = 1 }; | 17 | var foo = Foo{ .int = 1 }; |
| 14 | try expect(foo.int == 1); | 18 | try expect(foo.int == 1); |
| 15 | foo = Foo{ .float = 12.34 }; | 19 | foo = Foo{ .float = 12.34 }; |
| ... | @@ -17,6 +21,10 @@ test "basic unions" { | ... | @@ -17,6 +21,10 @@ test "basic unions" { |
| 17 | } | 21 | } |
| 18 | 22 | ||
| 19 | test "init union with runtime value" { | 23 | test "init union with runtime value" { |
| 24 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 25 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 26 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 27 | |||
| 20 | var foo: Foo = undefined; | 28 | var foo: Foo = undefined; |
| 21 | 29 | ||
| 22 | setFloat(&foo, 12.34); | 30 | setFloat(&foo, 12.34); |
| ... | @@ -35,6 +43,9 @@ fn setInt(foo: *Foo, x: i32) void { | ... | @@ -35,6 +43,9 @@ fn setInt(foo: *Foo, x: i32) void { |
| 35 | } | 43 | } |
| 36 | 44 | ||
| 37 | test "comptime union field access" { | 45 | test "comptime union field access" { |
| 46 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 47 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 48 | |||
| 38 | comptime { | 49 | comptime { |
| 39 | var foo = Foo{ .int = 0 }; | 50 | var foo = Foo{ .int = 0 }; |
| 40 | try expect(foo.int == 0); | 51 | try expect(foo.int == 0); |
| ... | @@ -50,6 +61,10 @@ const FooExtern = extern union { | ... | @@ -50,6 +61,10 @@ const FooExtern = extern union { |
| 50 | }; | 61 | }; |
| 51 | 62 | ||
| 52 | test "basic extern unions" { | 63 | test "basic extern unions" { |
| 64 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 65 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 66 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 67 | |||
| 53 | var foo = FooExtern{ .int = 1 }; | 68 | var foo = FooExtern{ .int = 1 }; |
| 54 | try expect(foo.int == 1); | 69 | try expect(foo.int == 1); |
| 55 | foo.float = 12.34; | 70 | foo.float = 12.34; |
| ... | @@ -61,10 +76,16 @@ const ExternPtrOrInt = extern union { | ... | @@ -61,10 +76,16 @@ const ExternPtrOrInt = extern union { |
| 61 | int: u64, | 76 | int: u64, |
| 62 | }; | 77 | }; |
| 63 | test "extern union size" { | 78 | test "extern union size" { |
| 79 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 80 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 81 | |||
| 64 | comptime try expect(@sizeOf(ExternPtrOrInt) == 8); | 82 | comptime try expect(@sizeOf(ExternPtrOrInt) == 8); |
| 65 | } | 83 | } |
| 66 | 84 | ||
| 67 | test "0-sized extern union definition" { | 85 | test "0-sized extern union definition" { |
| 86 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 87 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 88 | |||
| 68 | const U = extern union { | 89 | const U = extern union { |
| 69 | a: void, | 90 | a: void, |
| 70 | const f = 1; | 91 | const f = 1; |
| ... | @@ -94,6 +115,9 @@ const err = @as(anyerror!Agg, Agg{ | ... | @@ -94,6 +115,9 @@ const err = @as(anyerror!Agg, Agg{ |
| 94 | const array = [_]Value{ v1, v2, v1, v2 }; | 115 | const array = [_]Value{ v1, v2, v1, v2 }; |
| 95 | 116 | ||
| 96 | test "unions embedded in aggregate types" { | 117 | test "unions embedded in aggregate types" { |
| 118 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 119 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 120 | |||
| 97 | switch (array[1]) { | 121 | switch (array[1]) { |
| 98 | Value.Array => |arr| try expect(arr[4] == 3), | 122 | Value.Array => |arr| try expect(arr[4] == 3), |
| 99 | else => unreachable, | 123 | else => unreachable, |
| ... | @@ -105,6 +129,9 @@ test "unions embedded in aggregate types" { | ... | @@ -105,6 +129,9 @@ test "unions embedded in aggregate types" { |
| 105 | } | 129 | } |
| 106 | 130 | ||
| 107 | test "access a member of tagged union with conflicting enum tag name" { | 131 | test "access a member of tagged union with conflicting enum tag name" { |
| 132 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 133 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 134 | |||
| 108 | const Bar = union(enum) { | 135 | const Bar = union(enum) { |
| 109 | A: A, | 136 | A: A, |
| 110 | B: B, | 137 | B: B, |
| ... | @@ -117,6 +144,10 @@ test "access a member of tagged union with conflicting enum tag name" { | ... | @@ -117,6 +144,10 @@ test "access a member of tagged union with conflicting enum tag name" { |
| 117 | } | 144 | } |
| 118 | 145 | ||
| 119 | test "constant tagged union with payload" { | 146 | test "constant tagged union with payload" { |
| 147 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 148 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 149 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 150 | |||
| 120 | var empty = TaggedUnionWithPayload{ .Empty = {} }; | 151 | var empty = TaggedUnionWithPayload{ .Empty = {} }; |
| 121 | var full = TaggedUnionWithPayload{ .Full = 13 }; | 152 | var full = TaggedUnionWithPayload{ .Full = 13 }; |
| 122 | shouldBeEmpty(empty); | 153 | shouldBeEmpty(empty); |
| ... | @@ -143,6 +174,9 @@ const TaggedUnionWithPayload = union(enum) { | ... | @@ -143,6 +174,9 @@ const TaggedUnionWithPayload = union(enum) { |
| 143 | }; | 174 | }; |
| 144 | 175 | ||
| 145 | test "union alignment" { | 176 | test "union alignment" { |
| 177 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 178 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 179 | |||
| 146 | comptime { | 180 | comptime { |
| 147 | try expect(@alignOf(AlignTestTaggedUnion) >= @alignOf([9]u8)); | 181 | try expect(@alignOf(AlignTestTaggedUnion) >= @alignOf([9]u8)); |
| 148 | try expect(@alignOf(AlignTestTaggedUnion) >= @alignOf(u64)); | 182 | try expect(@alignOf(AlignTestTaggedUnion) >= @alignOf(u64)); |
| ... | @@ -162,11 +196,18 @@ const Payload = union(Letter) { | ... | @@ -162,11 +196,18 @@ const Payload = union(Letter) { |
| 162 | }; | 196 | }; |
| 163 | 197 | ||
| 164 | test "union with specified enum tag" { | 198 | test "union with specified enum tag" { |
| 199 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 200 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 201 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 202 | |||
| 165 | try doTest(); | 203 | try doTest(); |
| 166 | comptime try doTest(); | 204 | comptime try doTest(); |
| 167 | } | 205 | } |
| 168 | 206 | ||
| 169 | test "packed union generates correctly aligned LLVM type" { | 207 | test "packed union generates correctly aligned LLVM type" { |
| 208 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 209 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 210 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 170 | if (builtin.zig_backend == .stage1) return error.SkipZigTest; | 211 | if (builtin.zig_backend == .stage1) return error.SkipZigTest; |
| 171 | 212 | ||
| 172 | const U = packed union { | 213 | const U = packed union { |
| ... | @@ -204,6 +245,10 @@ fn testComparison() !void { | ... | @@ -204,6 +245,10 @@ fn testComparison() !void { |
| 204 | } | 245 | } |
| 205 | 246 | ||
| 206 | test "comparison between union and enum literal" { | 247 | test "comparison between union and enum literal" { |
| 248 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 249 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 250 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 251 | |||
| 207 | try testComparison(); | 252 | try testComparison(); |
| 208 | comptime try testComparison(); | 253 | comptime try testComparison(); |
| 209 | } | 254 | } |
| ... | @@ -215,6 +260,10 @@ const TheUnion = union(TheTag) { | ... | @@ -215,6 +260,10 @@ const TheUnion = union(TheTag) { |
| 215 | C: i32, | 260 | C: i32, |
| 216 | }; | 261 | }; |
| 217 | test "cast union to tag type of union" { | 262 | test "cast union to tag type of union" { |
| 263 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 264 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 265 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 266 | |||
| 218 | try testCastUnionToTag(); | 267 | try testCastUnionToTag(); |
| 219 | comptime try testCastUnionToTag(); | 268 | comptime try testCastUnionToTag(); |
| 220 | } | 269 | } |
| ... | @@ -225,12 +274,19 @@ fn testCastUnionToTag() !void { | ... | @@ -225,12 +274,19 @@ fn testCastUnionToTag() !void { |
| 225 | } | 274 | } |
| 226 | 275 | ||
| 227 | test "union field access gives the enum values" { | 276 | test "union field access gives the enum values" { |
| 277 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 278 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 279 | |||
| 228 | try expect(TheUnion.A == TheTag.A); | 280 | try expect(TheUnion.A == TheTag.A); |
| 229 | try expect(TheUnion.B == TheTag.B); | 281 | try expect(TheUnion.B == TheTag.B); |
| 230 | try expect(TheUnion.C == TheTag.C); | 282 | try expect(TheUnion.C == TheTag.C); |
| 231 | } | 283 | } |
| 232 | 284 | ||
| 233 | test "cast tag type of union to union" { | 285 | test "cast tag type of union to union" { |
| 286 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 287 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 288 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 289 | |||
| 234 | var x: Value2 = Letter2.B; | 290 | var x: Value2 = Letter2.B; |
| 235 | try expect(@as(Letter2, x) == Letter2.B); | 291 | try expect(@as(Letter2, x) == Letter2.B); |
| 236 | } | 292 | } |
| ... | @@ -242,6 +298,10 @@ const Value2 = union(Letter2) { | ... | @@ -242,6 +298,10 @@ const Value2 = union(Letter2) { |
| 242 | }; | 298 | }; |
| 243 | 299 | ||
| 244 | test "implicit cast union to its tag type" { | 300 | test "implicit cast union to its tag type" { |
| 301 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 302 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 303 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 304 | |||
| 245 | var x: Value2 = Letter2.B; | 305 | var x: Value2 = Letter2.B; |
| 246 | try expect(x == Letter2.B); | 306 | try expect(x == Letter2.B); |
| 247 | try giveMeLetterB(x); | 307 | try giveMeLetterB(x); |
| ... | @@ -258,6 +318,10 @@ pub const PackThis = union(enum) { | ... | @@ -258,6 +318,10 @@ pub const PackThis = union(enum) { |
| 258 | }; | 318 | }; |
| 259 | 319 | ||
| 260 | test "constant packed union" { | 320 | test "constant packed union" { |
| 321 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 322 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 323 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 324 | |||
| 261 | try testConstPackedUnion(&[_]PackThis{PackThis{ .StringLiteral = 1 }}); | 325 | try testConstPackedUnion(&[_]PackThis{PackThis{ .StringLiteral = 1 }}); |
| 262 | } | 326 | } |
| 263 | 327 | ||
| ... | @@ -272,6 +336,10 @@ const MultipleChoice = union(enum(u32)) { | ... | @@ -272,6 +336,10 @@ const MultipleChoice = union(enum(u32)) { |
| 272 | D = 1000, | 336 | D = 1000, |
| 273 | }; | 337 | }; |
| 274 | test "simple union(enum(u32))" { | 338 | test "simple union(enum(u32))" { |
| 339 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 340 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 341 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 342 | |||
| 275 | var x = MultipleChoice.C; | 343 | var x = MultipleChoice.C; |
| 276 | try expect(x == MultipleChoice.C); | 344 | try expect(x == MultipleChoice.C); |
| 277 | try expect(@enumToInt(@as(Tag(MultipleChoice), x)) == 60); | 345 | try expect(@enumToInt(@as(Tag(MultipleChoice), x)) == 60); |
| ... | @@ -282,6 +350,9 @@ const PackedPtrOrInt = packed union { | ... | @@ -282,6 +350,9 @@ const PackedPtrOrInt = packed union { |
| 282 | int: u64, | 350 | int: u64, |
| 283 | }; | 351 | }; |
| 284 | test "packed union size" { | 352 | test "packed union size" { |
| 353 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 354 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 355 | |||
| 285 | comptime try expect(@sizeOf(PackedPtrOrInt) == 8); | 356 | comptime try expect(@sizeOf(PackedPtrOrInt) == 8); |
| 286 | } | 357 | } |
| 287 | 358 | ||
| ... | @@ -289,10 +360,17 @@ const ZeroBits = union { | ... | @@ -289,10 +360,17 @@ const ZeroBits = union { |
| 289 | OnlyField: void, | 360 | OnlyField: void, |
| 290 | }; | 361 | }; |
| 291 | test "union with only 1 field which is void should be zero bits" { | 362 | test "union with only 1 field which is void should be zero bits" { |
| 363 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 364 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 365 | |||
| 292 | comptime try expect(@sizeOf(ZeroBits) == 0); | 366 | comptime try expect(@sizeOf(ZeroBits) == 0); |
| 293 | } | 367 | } |
| 294 | 368 | ||
| 295 | test "tagged union initialization with runtime void" { | 369 | test "tagged union initialization with runtime void" { |
| 370 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 371 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 372 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 373 | |||
| 296 | try expect(testTaggedUnionInit({})); | 374 | try expect(testTaggedUnionInit({})); |
| 297 | } | 375 | } |
| 298 | 376 | ||
| ... | @@ -309,6 +387,10 @@ fn testTaggedUnionInit(x: anytype) bool { | ... | @@ -309,6 +387,10 @@ fn testTaggedUnionInit(x: anytype) bool { |
| 309 | pub const UnionEnumNoPayloads = union(enum) { A, B }; | 387 | pub const UnionEnumNoPayloads = union(enum) { A, B }; |
| 310 | 388 | ||
| 311 | test "tagged union with no payloads" { | 389 | test "tagged union with no payloads" { |
| 390 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 391 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 392 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 393 | |||
| 312 | const a = UnionEnumNoPayloads{ .B = {} }; | 394 | const a = UnionEnumNoPayloads{ .B = {} }; |
| 313 | switch (a) { | 395 | switch (a) { |
| 314 | Tag(UnionEnumNoPayloads).A => @panic("wrong"), | 396 | Tag(UnionEnumNoPayloads).A => @panic("wrong"), |
| ... | @@ -317,6 +399,10 @@ test "tagged union with no payloads" { | ... | @@ -317,6 +399,10 @@ test "tagged union with no payloads" { |
| 317 | } | 399 | } |
| 318 | 400 | ||
| 319 | test "union with only 1 field casted to its enum type" { | 401 | test "union with only 1 field casted to its enum type" { |
| 402 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 403 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 404 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 405 | |||
| 320 | const Literal = union(enum) { | 406 | const Literal = union(enum) { |
| 321 | Number: f64, | 407 | Number: f64, |
| 322 | Bool: bool, | 408 | Bool: bool, |
| ... | @@ -334,6 +420,9 @@ test "union with only 1 field casted to its enum type" { | ... | @@ -334,6 +420,9 @@ test "union with only 1 field casted to its enum type" { |
| 334 | } | 420 | } |
| 335 | 421 | ||
| 336 | test "union with one member defaults to u0 tag type" { | 422 | test "union with one member defaults to u0 tag type" { |
| 423 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 424 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 425 | |||
| 337 | const U0 = union(enum) { | 426 | const U0 = union(enum) { |
| 338 | X: u32, | 427 | X: u32, |
| 339 | }; | 428 | }; |
| ... | @@ -348,6 +437,10 @@ const Foo1 = union(enum) { | ... | @@ -348,6 +437,10 @@ const Foo1 = union(enum) { |
| 348 | var glbl: Foo1 = undefined; | 437 | var glbl: Foo1 = undefined; |
| 349 | 438 | ||
| 350 | test "global union with single field is correctly initialized" { | 439 | test "global union with single field is correctly initialized" { |
| 440 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 441 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 442 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 443 | |||
| 351 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | 444 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO |
| 352 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO | 445 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO |
| 353 | 446 | ||
| ... | @@ -365,6 +458,10 @@ pub const FooUnion = union(enum) { | ... | @@ -365,6 +458,10 @@ pub const FooUnion = union(enum) { |
| 365 | var glbl_array: [2]FooUnion = undefined; | 458 | var glbl_array: [2]FooUnion = undefined; |
| 366 | 459 | ||
| 367 | test "initialize global array of union" { | 460 | test "initialize global array of union" { |
| 461 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 462 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 463 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 464 | |||
| 368 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; | 465 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; |
| 369 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; | 466 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; |
| 370 | 467 | ||
| ... | @@ -375,6 +472,10 @@ test "initialize global array of union" { | ... | @@ -375,6 +472,10 @@ test "initialize global array of union" { |
| 375 | } | 472 | } |
| 376 | 473 | ||
| 377 | test "update the tag value for zero-sized unions" { | 474 | test "update the tag value for zero-sized unions" { |
| 475 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 476 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 477 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 478 | |||
| 378 | const S = union(enum) { | 479 | const S = union(enum) { |
| 379 | U0: void, | 480 | U0: void, |
| 380 | U1: void, | 481 | U1: void, |
| ... | @@ -386,6 +487,10 @@ test "update the tag value for zero-sized unions" { | ... | @@ -386,6 +487,10 @@ test "update the tag value for zero-sized unions" { |
| 386 | } | 487 | } |
| 387 | 488 | ||
| 388 | test "union initializer generates padding only if needed" { | 489 | test "union initializer generates padding only if needed" { |
| 490 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 491 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 492 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 493 | |||
| 389 | const U = union(enum) { | 494 | const U = union(enum) { |
| 390 | A: u24, | 495 | A: u24, |
| 391 | }; | 496 | }; |
| ... | @@ -395,6 +500,10 @@ test "union initializer generates padding only if needed" { | ... | @@ -395,6 +500,10 @@ test "union initializer generates padding only if needed" { |
| 395 | } | 500 | } |
| 396 | 501 | ||
| 397 | test "runtime tag name with single field" { | 502 | test "runtime tag name with single field" { |
| 503 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 504 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 505 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 506 | |||
| 398 | const U = union(enum) { | 507 | const U = union(enum) { |
| 399 | A: i32, | 508 | A: i32, |
| 400 | }; | 509 | }; |
| ... | @@ -404,6 +513,10 @@ test "runtime tag name with single field" { | ... | @@ -404,6 +513,10 @@ test "runtime tag name with single field" { |
| 404 | } | 513 | } |
| 405 | 514 | ||
| 406 | test "method call on an empty union" { | 515 | test "method call on an empty union" { |
| 516 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 517 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 518 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 519 | |||
| 407 | const S = struct { | 520 | const S = struct { |
| 408 | const MyUnion = union(MyUnionTag) { | 521 | const MyUnion = union(MyUnionTag) { |
| 409 | pub const MyUnionTag = enum { X1, X2 }; | 522 | pub const MyUnionTag = enum { X1, X2 }; |
| ... | @@ -441,6 +554,10 @@ const FooNoVoid = union(enum) { | ... | @@ -441,6 +554,10 @@ const FooNoVoid = union(enum) { |
| 441 | const Baz = enum { A, B, C, D }; | 554 | const Baz = enum { A, B, C, D }; |
| 442 | 555 | ||
| 443 | test "tagged union type" { | 556 | test "tagged union type" { |
| 557 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 558 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 559 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 560 | |||
| 444 | const foo1 = TaggedFoo{ .One = 13 }; | 561 | const foo1 = TaggedFoo{ .One = 13 }; |
| 445 | const foo2 = TaggedFoo{ | 562 | const foo2 = TaggedFoo{ |
| 446 | .Two = Point{ | 563 | .Two = Point{ |
| ... | @@ -460,6 +577,10 @@ test "tagged union type" { | ... | @@ -460,6 +577,10 @@ test "tagged union type" { |
| 460 | } | 577 | } |
| 461 | 578 | ||
| 462 | test "tagged union as return value" { | 579 | test "tagged union as return value" { |
| 580 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 581 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 582 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 583 | |||
| 463 | switch (returnAnInt(13)) { | 584 | switch (returnAnInt(13)) { |
| 464 | TaggedFoo.One => |value| try expect(value == 13), | 585 | TaggedFoo.One => |value| try expect(value == 13), |
| 465 | else => unreachable, | 586 | else => unreachable, |
| ... | @@ -471,6 +592,10 @@ fn returnAnInt(x: i32) TaggedFoo { | ... | @@ -471,6 +592,10 @@ fn returnAnInt(x: i32) TaggedFoo { |
| 471 | } | 592 | } |
| 472 | 593 | ||
| 473 | test "tagged union with all void fields but a meaningful tag" { | 594 | test "tagged union with all void fields but a meaningful tag" { |
| 595 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 596 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 597 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 598 | |||
| 474 | const S = struct { | 599 | const S = struct { |
| 475 | const B = union(enum) { | 600 | const B = union(enum) { |
| 476 | c: C, | 601 | c: C, |
| ... | @@ -496,6 +621,9 @@ test "tagged union with all void fields but a meaningful tag" { | ... | @@ -496,6 +621,9 @@ test "tagged union with all void fields but a meaningful tag" { |
| 496 | 621 | ||
| 497 | test "union(enum(u32)) with specified and unspecified tag values" { | 622 | test "union(enum(u32)) with specified and unspecified tag values" { |
| 498 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | 623 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO |
| 624 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 625 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 626 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 499 | 627 | ||
| 500 | comptime try expect(Tag(Tag(MultipleChoice2)) == u32); | 628 | comptime try expect(Tag(Tag(MultipleChoice2)) == u32); |
| 501 | try testEnumWithSpecifiedAndUnspecifiedTagValues(MultipleChoice2{ .C = 123 }); | 629 | try testEnumWithSpecifiedAndUnspecifiedTagValues(MultipleChoice2{ .C = 123 }); |
| ... | @@ -558,6 +686,10 @@ const PartialInstWithPayload = union(enum) { | ... | @@ -558,6 +686,10 @@ const PartialInstWithPayload = union(enum) { |
| 558 | }; | 686 | }; |
| 559 | 687 | ||
| 560 | test "union with only 1 field casted to its enum type which has enum value specified" { | 688 | test "union with only 1 field casted to its enum type which has enum value specified" { |
| 689 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 690 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 691 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 692 | |||
| 561 | const Literal = union(enum) { | 693 | const Literal = union(enum) { |
| 562 | Number: f64, | 694 | Number: f64, |
| 563 | Bool: bool, | 695 | Bool: bool, |
| ... | @@ -638,6 +770,10 @@ fn Setter(attr: Attribute) type { | ... | @@ -638,6 +770,10 @@ fn Setter(attr: Attribute) type { |
| 638 | } | 770 | } |
| 639 | 771 | ||
| 640 | test "return union init with void payload" { | 772 | test "return union init with void payload" { |
| 773 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 774 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 775 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 776 | |||
| 641 | const S = struct { | 777 | const S = struct { |
| 642 | fn entry() !void { | 778 | fn entry() !void { |
| 643 | try expect(func().state == State.one); | 779 | try expect(func().state == State.one); |
| ... | @@ -948,6 +1084,9 @@ test "union enum type gets a separate scope" { | ... | @@ -948,6 +1084,9 @@ test "union enum type gets a separate scope" { |
| 948 | test "global variable struct contains union initialized to non-most-aligned field" { | 1084 | test "global variable struct contains union initialized to non-most-aligned field" { |
| 949 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO | 1085 | if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO |
| 950 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO | 1086 | if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO |
| 1087 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 1088 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 1089 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 951 | 1090 | ||
| 952 | const T = struct { | 1091 | const T = struct { |
| 953 | const U = union(enum) { | 1092 | const U = union(enum) { |
test/behavior/usingnamespace.zig+19| ... | @@ -1,4 +1,5 @@ | ... | @@ -1,4 +1,5 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | const builtin = @import("builtin"); | ||
| 2 | const expect = std.testing.expect; | 3 | const expect = std.testing.expect; |
| 3 | 4 | ||
| 4 | const A = struct { | 5 | const A = struct { |
| ... | @@ -10,6 +11,9 @@ const C = struct { | ... | @@ -10,6 +11,9 @@ const C = struct { |
| 10 | }; | 11 | }; |
| 11 | 12 | ||
| 12 | test "basic usingnamespace" { | 13 | test "basic usingnamespace" { |
| 14 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 15 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 16 | |||
| 13 | try std.testing.expect(C.B == bool); | 17 | try std.testing.expect(C.B == bool); |
| 14 | } | 18 | } |
| 15 | 19 | ||
| ... | @@ -20,6 +24,9 @@ fn Foo(comptime T: type) type { | ... | @@ -20,6 +24,9 @@ fn Foo(comptime T: type) type { |
| 20 | } | 24 | } |
| 21 | 25 | ||
| 22 | test "usingnamespace inside a generic struct" { | 26 | test "usingnamespace inside a generic struct" { |
| 27 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 28 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 29 | |||
| 23 | const std2 = Foo(std); | 30 | const std2 = Foo(std); |
| 24 | const testing2 = Foo(std.testing); | 31 | const testing2 = Foo(std.testing); |
| 25 | try std2.testing.expect(true); | 32 | try std2.testing.expect(true); |
| ... | @@ -31,11 +38,17 @@ usingnamespace struct { | ... | @@ -31,11 +38,17 @@ usingnamespace struct { |
| 31 | }; | 38 | }; |
| 32 | 39 | ||
| 33 | test "usingnamespace does not redeclare an imported variable" { | 40 | test "usingnamespace does not redeclare an imported variable" { |
| 41 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 42 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 43 | |||
| 34 | comptime try std.testing.expect(@This().foo == 42); | 44 | comptime try std.testing.expect(@This().foo == 42); |
| 35 | } | 45 | } |
| 36 | 46 | ||
| 37 | usingnamespace @import("usingnamespace/foo.zig"); | 47 | usingnamespace @import("usingnamespace/foo.zig"); |
| 38 | test "usingnamespace omits mixing in private functions" { | 48 | test "usingnamespace omits mixing in private functions" { |
| 49 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 50 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 51 | |||
| 39 | try expect(@This().privateFunction()); | 52 | try expect(@This().privateFunction()); |
| 40 | try expect(!@This().printText()); | 53 | try expect(!@This().printText()); |
| 41 | } | 54 | } |
| ... | @@ -44,10 +57,16 @@ fn privateFunction() bool { | ... | @@ -44,10 +57,16 @@ fn privateFunction() bool { |
| 44 | } | 57 | } |
| 45 | 58 | ||
| 46 | test { | 59 | test { |
| 60 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 61 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 62 | |||
| 47 | _ = @import("usingnamespace/import_segregation.zig"); | 63 | _ = @import("usingnamespace/import_segregation.zig"); |
| 48 | } | 64 | } |
| 49 | 65 | ||
| 50 | usingnamespace @import("usingnamespace/a.zig"); | 66 | usingnamespace @import("usingnamespace/a.zig"); |
| 51 | test "two files usingnamespace import each other" { | 67 | test "two files usingnamespace import each other" { |
| 68 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 69 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 70 | |||
| 52 | try expect(@This().ok()); | 71 | try expect(@This().ok()); |
| 53 | } | 72 | } |
test/behavior/void.zig+11| ... | @@ -1,4 +1,5 @@ | ... | @@ -1,4 +1,5 @@ |
| 1 | const expect = @import("std").testing.expect; | 1 | const expect = @import("std").testing.expect; |
| 2 | const builtin = @import("builtin"); | ||
| 2 | 3 | ||
| 3 | const Foo = struct { | 4 | const Foo = struct { |
| 4 | a: void, | 5 | a: void, |
| ... | @@ -18,6 +19,9 @@ test "compare void with void compile time known" { | ... | @@ -18,6 +19,9 @@ test "compare void with void compile time known" { |
| 18 | } | 19 | } |
| 19 | 20 | ||
| 20 | test "iterate over a void slice" { | 21 | test "iterate over a void slice" { |
| 22 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 23 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 24 | |||
| 21 | var j: usize = 0; | 25 | var j: usize = 0; |
| 22 | for (times(10)) |_, i| { | 26 | for (times(10)) |_, i| { |
| 23 | try expect(i == j); | 27 | try expect(i == j); |
| ... | @@ -30,11 +34,18 @@ fn times(n: usize) []const void { | ... | @@ -30,11 +34,18 @@ fn times(n: usize) []const void { |
| 30 | } | 34 | } |
| 31 | 35 | ||
| 32 | test "void optional" { | 36 | test "void optional" { |
| 37 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 38 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 39 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 40 | |||
| 33 | var x: ?void = {}; | 41 | var x: ?void = {}; |
| 34 | try expect(x != null); | 42 | try expect(x != null); |
| 35 | } | 43 | } |
| 36 | 44 | ||
| 37 | test "void array as a local variable initializer" { | 45 | test "void array as a local variable initializer" { |
| 46 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 47 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 48 | |||
| 38 | var x = [_]void{{}} ** 1004; | 49 | var x = [_]void{{}} ** 1004; |
| 39 | _ = x[0]; | 50 | _ = x[0]; |
| 40 | } | 51 | } |
test/behavior/while.zig+47| ... | @@ -1,7 +1,11 @@ | ... | @@ -1,7 +1,11 @@ |
| 1 | const std = @import("std"); | 1 | const std = @import("std"); |
| 2 | const builtin = @import("builtin"); | ||
| 2 | const expect = std.testing.expect; | 3 | const expect = std.testing.expect; |
| 3 | 4 | ||
| 4 | test "while loop" { | 5 | test "while loop" { |
| 6 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 7 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 8 | |||
| 5 | var i: i32 = 0; | 9 | var i: i32 = 0; |
| 6 | while (i < 4) { | 10 | while (i < 4) { |
| 7 | i += 1; | 11 | i += 1; |
| ... | @@ -19,6 +23,9 @@ fn whileLoop2() i32 { | ... | @@ -19,6 +23,9 @@ fn whileLoop2() i32 { |
| 19 | } | 23 | } |
| 20 | 24 | ||
| 21 | test "static eval while" { | 25 | test "static eval while" { |
| 26 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 27 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 28 | |||
| 22 | try expect(static_eval_while_number == 1); | 29 | try expect(static_eval_while_number == 1); |
| 23 | } | 30 | } |
| 24 | const static_eval_while_number = staticWhileLoop1(); | 31 | const static_eval_while_number = staticWhileLoop1(); |
| ... | @@ -98,6 +105,10 @@ fn testBreakOuter() void { | ... | @@ -98,6 +105,10 @@ fn testBreakOuter() void { |
| 98 | } | 105 | } |
| 99 | 106 | ||
| 100 | test "while copies its payload" { | 107 | test "while copies its payload" { |
| 108 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 109 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 110 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 111 | |||
| 101 | const S = struct { | 112 | const S = struct { |
| 102 | fn doTheTest() !void { | 113 | fn doTheTest() !void { |
| 103 | var tmp: ?i32 = 10; | 114 | var tmp: ?i32 = 10; |
| ... | @@ -131,6 +142,10 @@ fn runContinueAndBreakTest() !void { | ... | @@ -131,6 +142,10 @@ fn runContinueAndBreakTest() !void { |
| 131 | } | 142 | } |
| 132 | 143 | ||
| 133 | test "while with optional as condition" { | 144 | test "while with optional as condition" { |
| 145 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 146 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 147 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 148 | |||
| 134 | numbers_left = 10; | 149 | numbers_left = 10; |
| 135 | var sum: i32 = 0; | 150 | var sum: i32 = 0; |
| 136 | while (getNumberOrNull()) |value| { | 151 | while (getNumberOrNull()) |value| { |
| ... | @@ -140,6 +155,10 @@ test "while with optional as condition" { | ... | @@ -140,6 +155,10 @@ test "while with optional as condition" { |
| 140 | } | 155 | } |
| 141 | 156 | ||
| 142 | test "while with optional as condition with else" { | 157 | test "while with optional as condition with else" { |
| 158 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 159 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 160 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 161 | |||
| 143 | numbers_left = 10; | 162 | numbers_left = 10; |
| 144 | var sum: i32 = 0; | 163 | var sum: i32 = 0; |
| 145 | var got_else: i32 = 0; | 164 | var got_else: i32 = 0; |
| ... | @@ -154,6 +173,10 @@ test "while with optional as condition with else" { | ... | @@ -154,6 +173,10 @@ test "while with optional as condition with else" { |
| 154 | } | 173 | } |
| 155 | 174 | ||
| 156 | test "while with error union condition" { | 175 | test "while with error union condition" { |
| 176 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 177 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 178 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 179 | |||
| 157 | numbers_left = 10; | 180 | numbers_left = 10; |
| 158 | var sum: i32 = 0; | 181 | var sum: i32 = 0; |
| 159 | var got_else: i32 = 0; | 182 | var got_else: i32 = 0; |
| ... | @@ -182,6 +205,10 @@ test "while on bool with else result follow break prong" { | ... | @@ -182,6 +205,10 @@ test "while on bool with else result follow break prong" { |
| 182 | } | 205 | } |
| 183 | 206 | ||
| 184 | test "while on optional with else result follow else prong" { | 207 | test "while on optional with else result follow else prong" { |
| 208 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 209 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 210 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 211 | |||
| 185 | const result = while (returnNull()) |value| { | 212 | const result = while (returnNull()) |value| { |
| 186 | break value; | 213 | break value; |
| 187 | } else @as(i32, 2); | 214 | } else @as(i32, 2); |
| ... | @@ -189,6 +216,10 @@ test "while on optional with else result follow else prong" { | ... | @@ -189,6 +216,10 @@ test "while on optional with else result follow else prong" { |
| 189 | } | 216 | } |
| 190 | 217 | ||
| 191 | test "while on optional with else result follow break prong" { | 218 | test "while on optional with else result follow break prong" { |
| 219 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 220 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 221 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 222 | |||
| 192 | const result = while (returnOptional(10)) |value| { | 223 | const result = while (returnOptional(10)) |value| { |
| 193 | break value; | 224 | break value; |
| 194 | } else @as(i32, 2); | 225 | } else @as(i32, 2); |
| ... | @@ -215,6 +246,10 @@ fn returnTrue() bool { | ... | @@ -215,6 +246,10 @@ fn returnTrue() bool { |
| 215 | } | 246 | } |
| 216 | 247 | ||
| 217 | test "return with implicit cast from while loop" { | 248 | test "return with implicit cast from while loop" { |
| 249 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 250 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 251 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 252 | |||
| 218 | returnWithImplicitCastFromWhileLoopTest() catch unreachable; | 253 | returnWithImplicitCastFromWhileLoopTest() catch unreachable; |
| 219 | } | 254 | } |
| 220 | fn returnWithImplicitCastFromWhileLoopTest() anyerror!void { | 255 | fn returnWithImplicitCastFromWhileLoopTest() anyerror!void { |
| ... | @@ -224,6 +259,10 @@ fn returnWithImplicitCastFromWhileLoopTest() anyerror!void { | ... | @@ -224,6 +259,10 @@ fn returnWithImplicitCastFromWhileLoopTest() anyerror!void { |
| 224 | } | 259 | } |
| 225 | 260 | ||
| 226 | test "while on error union with else result follow else prong" { | 261 | test "while on error union with else result follow else prong" { |
| 262 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 263 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 264 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 265 | |||
| 227 | const result = while (returnError()) |value| { | 266 | const result = while (returnError()) |value| { |
| 228 | break value; | 267 | break value; |
| 229 | } else |_| @as(i32, 2); | 268 | } else |_| @as(i32, 2); |
| ... | @@ -231,6 +270,10 @@ test "while on error union with else result follow else prong" { | ... | @@ -231,6 +270,10 @@ test "while on error union with else result follow else prong" { |
| 231 | } | 270 | } |
| 232 | 271 | ||
| 233 | test "while on error union with else result follow break prong" { | 272 | test "while on error union with else result follow break prong" { |
| 273 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 274 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 275 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 276 | |||
| 234 | const result = while (returnSuccess(10)) |value| { | 277 | const result = while (returnSuccess(10)) |value| { |
| 235 | break value; | 278 | break value; |
| 236 | } else |_| @as(i32, 2); | 279 | } else |_| @as(i32, 2); |
| ... | @@ -253,6 +296,10 @@ test "while bool 2 break statements and an else" { | ... | @@ -253,6 +296,10 @@ test "while bool 2 break statements and an else" { |
| 253 | } | 296 | } |
| 254 | 297 | ||
| 255 | test "while optional 2 break statements and an else" { | 298 | test "while optional 2 break statements and an else" { |
| 299 | if (builtin.zig_backend == .stage2_x86_64) return error.SkipZigTest; | ||
| 300 | if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; | ||
| 301 | if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; | ||
| 302 | |||
| 256 | const S = struct { | 303 | const S = struct { |
| 257 | fn entry(opt_t: ?bool, f: bool) !void { | 304 | fn entry(opt_t: ?bool, f: bool) !void { |
| 258 | var ok = false; | 305 | var ok = false; |