| author | |
| committer | |
| log | 68add5d8286e5c517143b16a457a86a6c23dbc64 |
| tree | 1058b55e8f0b86ad523012c89975ded539fffac5 |
| parent | 0065eb7c80c2bb68585e42b87131f374e1d3fcbc |
21 files changed, 89 insertions(+), 89 deletions(-)
test/cases/array.zig+5-5| ... | ... | @@ -25,7 +25,7 @@ fn getArrayLen(a: []const u32) -> usize { |
| 25 | 25 | a.len |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | test "voidArrays" { | |
| 28 | test "void arrays" { | |
| 29 | 29 | var array: [4]void = undefined; |
| 30 | 30 | array[0] = void{}; |
| 31 | 31 | array[1] = array[2]; |
| ... | ... | @@ -33,14 +33,14 @@ test "voidArrays" { |
| 33 | 33 | assert(array.len == 4); |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | test "arrayLiteral" { | |
| 36 | test "array literal" { | |
| 37 | 37 | const hex_mult = []u16{4096, 256, 16, 1}; |
| 38 | 38 | |
| 39 | 39 | assert(hex_mult.len == 4); |
| 40 | 40 | assert(hex_mult[1] == 256); |
| 41 | 41 | } |
| 42 | 42 | |
| 43 | test "arrayDotLenConstExpr" { | |
| 43 | test "array dot len const expr" { | |
| 44 | 44 | assert(comptime {some_array.len == 4}); |
| 45 | 45 | } |
| 46 | 46 | |
| ... | ... | @@ -50,7 +50,7 @@ const ArrayDotLenConstExpr = struct { |
| 50 | 50 | const some_array = []u8 {0, 1, 2, 3}; |
| 51 | 51 | |
| 52 | 52 | |
| 53 | test "nestedArrays" { | |
| 53 | test "nested arrays" { | |
| 54 | 54 | const array_of_strings = [][]const u8 {"hello", "this", "is", "my", "thing"}; |
| 55 | 55 | for (array_of_strings) |s, i| { |
| 56 | 56 | if (i == 0) assert(mem.eql(u8, s, "hello")); |
| ... | ... | @@ -69,7 +69,7 @@ const Sub = struct { |
| 69 | 69 | const Str = struct { |
| 70 | 70 | a: []Sub, |
| 71 | 71 | }; |
| 72 | test "setGlobalVarArrayViaSliceEmbeddedInStruct" { | |
| 72 | test "set global var array via slice embedded in struct" { | |
| 73 | 73 | var s = Str { .a = s_array[0..]}; |
| 74 | 74 | |
| 75 | 75 | s.a[0].b = 1; |
test/cases/bool.zig+4-4| ... | ... | @@ -1,11 +1,11 @@ |
| 1 | 1 | const assert = @import("std").debug.assert; |
| 2 | 2 | |
| 3 | test "boolLiterals" { | |
| 3 | test "bool literals" { | |
| 4 | 4 | assert(true); |
| 5 | 5 | assert(!false); |
| 6 | 6 | } |
| 7 | 7 | |
| 8 | test "castBoolToInt" { | |
| 8 | test "cast bool to int" { | |
| 9 | 9 | const t = true; |
| 10 | 10 | const f = false; |
| 11 | 11 | assert(i32(t) == i32(1)); |
| ... | ... | @@ -18,7 +18,7 @@ fn nonConstCastBoolToInt(t: bool, f: bool) { |
| 18 | 18 | assert(i32(f) == i32(0)); |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | test "boolCmp" { | |
| 21 | test "bool cmp" { | |
| 22 | 22 | assert(testBoolCmp(true, false) == false); |
| 23 | 23 | } |
| 24 | 24 | fn testBoolCmp(a: bool, b: bool) -> bool { |
| ... | ... | @@ -29,7 +29,7 @@ const global_f = false; |
| 29 | 29 | const global_t = true; |
| 30 | 30 | const not_global_f = !global_f; |
| 31 | 31 | const not_global_t = !global_t; |
| 32 | test "compileTimeBoolnot" { | |
| 32 | test "compile time bool not" { | |
| 33 | 33 | assert(not_global_f); |
| 34 | 34 | assert(!not_global_t); |
| 35 | 35 | } |
test/cases/cast.zig+2-2| ... | ... | @@ -8,12 +8,12 @@ test "int to ptr cast" { |
| 8 | 8 | assert(z == 13); |
| 9 | 9 | } |
| 10 | 10 | |
| 11 | test "numLitIntToPtrCast" { | |
| 11 | test "integer literal to pointer cast" { | |
| 12 | 12 | const vga_mem = @intToPtr(&u16, 0xB8000); |
| 13 | 13 | assert(usize(vga_mem) == 0xB8000); |
| 14 | 14 | } |
| 15 | 15 | |
| 16 | test "pointerReinterpretConstFloatToInt" { | |
| 16 | test "pointer reinterpret const float to int" { | |
| 17 | 17 | const float: f64 = 5.99999999999994648725e-01; |
| 18 | 18 | const float_ptr = &float; |
| 19 | 19 | const int_ptr = @ptrCast(&i32, float_ptr); |
test/cases/const_slice_child.zig+1-1| ... | ... | @@ -3,7 +3,7 @@ const assert = debug.assert; |
| 3 | 3 | |
| 4 | 4 | var argv: &const &const u8 = undefined; |
| 5 | 5 | |
| 6 | test "constSliceChild" { | |
| 6 | test "const slice child" { | |
| 7 | 7 | const strs = ([]&const u8) { |
| 8 | 8 | c"one", |
| 9 | 9 | c"two", |
test/cases/enum.zig+6-6| ... | ... | @@ -1,7 +1,7 @@ |
| 1 | 1 | const assert = @import("std").debug.assert; |
| 2 | 2 | const mem = @import("std").mem; |
| 3 | 3 | |
| 4 | test "enumType" { | |
| 4 | test "enum type" { | |
| 5 | 5 | const foo1 = Foo.One {13}; |
| 6 | 6 | const foo2 = Foo.Two { Point { .x = 1234, .y = 5678, }}; |
| 7 | 7 | const bar = Bar.B; |
| ... | ... | @@ -14,7 +14,7 @@ test "enumType" { |
| 14 | 14 | assert(@sizeOf(Bar) == 1); |
| 15 | 15 | } |
| 16 | 16 | |
| 17 | test "enumAsReturnValue" { | |
| 17 | test "enum as return value" { | |
| 18 | 18 | switch (returnAnInt(13)) { |
| 19 | 19 | Foo.One => |value| assert(value == 13), |
| 20 | 20 | else => unreachable, |
| ... | ... | @@ -42,7 +42,7 @@ fn returnAnInt(x: i32) -> Foo { |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | |
| 45 | test "constantEnumWithPayload" { | |
| 45 | test "constant enum with payload" { | |
| 46 | 46 | var empty = AnEnumWithPayload.Empty; |
| 47 | 47 | var full = AnEnumWithPayload.Full {13}; |
| 48 | 48 | shouldBeEmpty(empty); |
| ... | ... | @@ -78,7 +78,7 @@ const Number = enum { |
| 78 | 78 | Four, |
| 79 | 79 | }; |
| 80 | 80 | |
| 81 | test "enumToInt" { | |
| 81 | test "enum to int" { | |
| 82 | 82 | shouldEqual(Number.Zero, 0); |
| 83 | 83 | shouldEqual(Number.One, 1); |
| 84 | 84 | shouldEqual(Number.Two, 2); |
| ... | ... | @@ -91,7 +91,7 @@ fn shouldEqual(n: Number, expected: usize) { |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | |
| 94 | test "intToEnum" { | |
| 94 | test "int to enum" { | |
| 95 | 95 | testIntToEnumEval(3); |
| 96 | 96 | } |
| 97 | 97 | fn testIntToEnumEval(x: i32) { |
| ... | ... | @@ -106,7 +106,7 @@ const IntToEnumNumber = enum { |
| 106 | 106 | }; |
| 107 | 107 | |
| 108 | 108 | |
| 109 | test "enumTagName builtin function" { | |
| 109 | test "@enumTagName" { | |
| 110 | 110 | assert(mem.eql(u8, testEnumTagNameBare(BareNumber.Three), "Three")); |
| 111 | 111 | comptime assert(mem.eql(u8, testEnumTagNameBare(BareNumber.Three), "Three")); |
| 112 | 112 | } |
test/cases/enum_with_members.zig+1-1| ... | ... | @@ -14,7 +14,7 @@ const ET = enum { |
| 14 | 14 | } |
| 15 | 15 | }; |
| 16 | 16 | |
| 17 | test "enumWithMembers" { | |
| 17 | test "enum with members" { | |
| 18 | 18 | const a = ET.SINT { -42 }; |
| 19 | 19 | const b = ET.UINT { 42 }; |
| 20 | 20 | var buf: [20]u8 = undefined; |
test/cases/error.zig+7-7| ... | ... | @@ -15,7 +15,7 @@ pub fn baz() -> %i32 { |
| 15 | 15 | return y + 1; |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | test "errorWrapping" { | |
| 18 | test "error wrapping" { | |
| 19 | 19 | assert(%%baz() == 15); |
| 20 | 20 | } |
| 21 | 21 | |
| ... | ... | @@ -24,7 +24,7 @@ fn gimmeItBroke() -> []const u8 { |
| 24 | 24 | @errorName(error.ItBroke) |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | test "errorName" { | |
| 27 | test "@errorName" { | |
| 28 | 28 | assert(mem.eql(u8, @errorName(error.AnError), "AnError")); |
| 29 | 29 | assert(mem.eql(u8, @errorName(error.ALongerErrorName), "ALongerErrorName")); |
| 30 | 30 | } |
| ... | ... | @@ -32,7 +32,7 @@ error AnError; |
| 32 | 32 | error ALongerErrorName; |
| 33 | 33 | |
| 34 | 34 | |
| 35 | test "errorValues" { | |
| 35 | test "error values" { | |
| 36 | 36 | const a = i32(error.err1); |
| 37 | 37 | const b = i32(error.err2); |
| 38 | 38 | assert(a != b); |
| ... | ... | @@ -41,7 +41,7 @@ error err1; |
| 41 | 41 | error err2; |
| 42 | 42 | |
| 43 | 43 | |
| 44 | test "redefinitionOfErrorValuesAllowed" { | |
| 44 | test "redefinition of error values allowed" { | |
| 45 | 45 | shouldBeNotEqual(error.AnError, error.SecondError); |
| 46 | 46 | } |
| 47 | 47 | error AnError; |
| ... | ... | @@ -52,7 +52,7 @@ fn shouldBeNotEqual(a: error, b: error) { |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | |
| 55 | test "errBinaryOperator" { | |
| 55 | test "error binary operator" { | |
| 56 | 56 | const a = errBinaryOperatorG(true) %% 3; |
| 57 | 57 | const b = errBinaryOperatorG(false) %% 3; |
| 58 | 58 | assert(a == 3); |
| ... | ... | @@ -68,14 +68,14 @@ fn errBinaryOperatorG(x: bool) -> %isize { |
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | |
| 71 | test "unwrapSimpleValueFromError" { | |
| 71 | test "unwrap simple value from error" { | |
| 72 | 72 | const i = %%unwrapSimpleValueFromErrorDo(); |
| 73 | 73 | assert(i == 13); |
| 74 | 74 | } |
| 75 | 75 | fn unwrapSimpleValueFromErrorDo() -> %isize { 13 } |
| 76 | 76 | |
| 77 | 77 | |
| 78 | test "errReturnInAssignment" { | |
| 78 | test "error return in assignment" { | |
| 79 | 79 | %%doErrReturnInAssignment(); |
| 80 | 80 | } |
| 81 | 81 |
test/cases/eval.zig+18-18| ... | ... | @@ -1,7 +1,7 @@ |
| 1 | 1 | const assert = @import("std").debug.assert; |
| 2 | 2 | const builtin = @import("builtin"); |
| 3 | 3 | |
| 4 | test "compileTimeRecursion" { | |
| 4 | test "compile time recursion" { | |
| 5 | 5 | assert(some_data.len == 21); |
| 6 | 6 | } |
| 7 | 7 | var some_data: [usize(fibonacci(7))]u8 = undefined; |
| ... | ... | @@ -16,11 +16,11 @@ fn unwrapAndAddOne(blah: ?i32) -> i32 { |
| 16 | 16 | return ??blah + 1; |
| 17 | 17 | } |
| 18 | 18 | const should_be_1235 = unwrapAndAddOne(1234); |
| 19 | test "testStaticAddOne" { | |
| 19 | test "static add one" { | |
| 20 | 20 | assert(should_be_1235 == 1235); |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | test "inlinedLoop" { | |
| 23 | test "inlined loop" { | |
| 24 | 24 | comptime var i = 0; |
| 25 | 25 | comptime var sum = 0; |
| 26 | 26 | inline while (i <= 5) : (i += 1) |
| ... | ... | @@ -34,20 +34,20 @@ fn gimme1or2(comptime a: bool) -> i32 { |
| 34 | 34 | comptime var z: i32 = if (a) x else y; |
| 35 | 35 | return z; |
| 36 | 36 | } |
| 37 | test "inlineVariableGetsResultOfConstIf" { | |
| 37 | test "inline variable gets result of const if" { | |
| 38 | 38 | assert(gimme1or2(true) == 1); |
| 39 | 39 | assert(gimme1or2(false) == 2); |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | |
| 43 | test "staticFunctionEvaluation" { | |
| 43 | test "static function evaluation" { | |
| 44 | 44 | assert(statically_added_number == 3); |
| 45 | 45 | } |
| 46 | 46 | const statically_added_number = staticAdd(1, 2); |
| 47 | 47 | fn staticAdd(a: i32, b: i32) -> i32 { a + b } |
| 48 | 48 | |
| 49 | 49 | |
| 50 | test "constExprEvalOnSingleExprBlocks" { | |
| 50 | test "const expr eval on single expr blocks" { | |
| 51 | 51 | assert(constExprEvalOnSingleExprBlocksFn(1, true) == 3); |
| 52 | 52 | } |
| 53 | 53 | |
| ... | ... | @@ -66,7 +66,7 @@ fn constExprEvalOnSingleExprBlocksFn(x: i32, b: bool) -> i32 { |
| 66 | 66 | |
| 67 | 67 | |
| 68 | 68 | |
| 69 | test "staticallyInitalizedList" { | |
| 69 | test "statically initialized list" { | |
| 70 | 70 | assert(static_point_list[0].x == 1); |
| 71 | 71 | assert(static_point_list[0].y == 2); |
| 72 | 72 | assert(static_point_list[1].x == 3); |
| ... | ... | @@ -85,7 +85,7 @@ fn makePoint(x: i32, y: i32) -> Point { |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | |
| 88 | test "staticEvalListInit" { | |
| 88 | test "static eval list init" { | |
| 89 | 89 | assert(static_vec3.data[2] == 1.0); |
| 90 | 90 | assert(vec3(0.0, 0.0, 3.0).data[2] == 3.0); |
| 91 | 91 | } |
| ... | ... | @@ -100,14 +100,14 @@ pub fn vec3(x: f32, y: f32, z: f32) -> Vec3 { |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | |
| 103 | test "constantExpressions" { | |
| 103 | test "constant expressions" { | |
| 104 | 104 | var array : [array_size]u8 = undefined; |
| 105 | 105 | assert(@sizeOf(@typeOf(array)) == 20); |
| 106 | 106 | } |
| 107 | 107 | const array_size : u8 = 20; |
| 108 | 108 | |
| 109 | 109 | |
| 110 | test "constantStructWithNegation" { | |
| 110 | test "constant struct with negation" { | |
| 111 | 111 | assert(vertices[0].x == -0.6); |
| 112 | 112 | } |
| 113 | 113 | const Vertex = struct { |
| ... | ... | @@ -124,7 +124,7 @@ const vertices = []Vertex { |
| 124 | 124 | }; |
| 125 | 125 | |
| 126 | 126 | |
| 127 | test "staticallyInitalizedStruct" { | |
| 127 | test "statically initialized struct" { | |
| 128 | 128 | st_init_str_foo.x += 1; |
| 129 | 129 | assert(st_init_str_foo.x == 14); |
| 130 | 130 | } |
| ... | ... | @@ -135,14 +135,14 @@ const StInitStrFoo = struct { |
| 135 | 135 | var st_init_str_foo = StInitStrFoo { .x = 13, .y = true, }; |
| 136 | 136 | |
| 137 | 137 | |
| 138 | test "staticallyInitializedArrayLiteral" { | |
| 138 | test "statically initalized array literal" { | |
| 139 | 139 | const y : [4]u8 = st_init_arr_lit_x; |
| 140 | 140 | assert(y[3] == 4); |
| 141 | 141 | } |
| 142 | 142 | const st_init_arr_lit_x = []u8{1,2,3,4}; |
| 143 | 143 | |
| 144 | 144 | |
| 145 | test "constSlice" { | |
| 145 | test "const slice" { | |
| 146 | 146 | comptime { |
| 147 | 147 | const a = "1234567890"; |
| 148 | 148 | assert(a.len == 10); |
| ... | ... | @@ -152,7 +152,7 @@ test "constSlice" { |
| 152 | 152 | } |
| 153 | 153 | } |
| 154 | 154 | |
| 155 | test "tryToTrickEvalWithRuntimeIf" { | |
| 155 | test "try to trick eval with runtime if" { | |
| 156 | 156 | assert(testTryToTrickEvalWithRuntimeIf(true) == 10); |
| 157 | 157 | } |
| 158 | 158 | |
| ... | ... | @@ -178,7 +178,7 @@ fn max(comptime T: type, a: T, b: T) -> T { |
| 178 | 178 | fn letsTryToCompareBools(a: bool, b: bool) -> bool { |
| 179 | 179 | max(bool, a, b) |
| 180 | 180 | } |
| 181 | test "inlinedBlockAndRuntimeBlockPhi" { | |
| 181 | test "inlined block and runtime block phi" { | |
| 182 | 182 | assert(letsTryToCompareBools(true, true)); |
| 183 | 183 | assert(letsTryToCompareBools(true, false)); |
| 184 | 184 | assert(letsTryToCompareBools(false, true)); |
| ... | ... | @@ -217,7 +217,7 @@ fn performFn(comptime prefix_char: u8, start_value: i32) -> i32 { |
| 217 | 217 | return result; |
| 218 | 218 | } |
| 219 | 219 | |
| 220 | test "comptimeIterateOverFnPtrList" { | |
| 220 | test "comptime iterate over fn ptr list" { | |
| 221 | 221 | assert(performFn('t', 1) == 6); |
| 222 | 222 | assert(performFn('o', 0) == 1); |
| 223 | 223 | assert(performFn('w', 99) == 99); |
| ... | ... | @@ -256,13 +256,13 @@ var simple_struct = SimpleStruct{ .field = 1234, }; |
| 256 | 256 | |
| 257 | 257 | const bound_fn = simple_struct.method; |
| 258 | 258 | |
| 259 | test "callMethodOnBoundFnReferringToVarInstance" { | |
| 259 | test "call method on bound fn referring to var instance" { | |
| 260 | 260 | assert(bound_fn() == 1237); |
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | |
| 264 | 264 | |
| 265 | test "ptrToLocalArrayArgumentAtComptime" { | |
| 265 | test "ptr to local array argument at comptime" { | |
| 266 | 266 | comptime { |
| 267 | 267 | var bytes: [10]u8 = undefined; |
| 268 | 268 | modifySomeBytes(bytes[0..]); |
test/cases/ir_block_deps.zig+1-1| ... | ... | @@ -15,7 +15,7 @@ fn getErrInt() -> %i32 { 0 } |
| 15 | 15 | |
| 16 | 16 | error ItBroke; |
| 17 | 17 | |
| 18 | test "irBlockDeps" { | |
| 18 | test "ir block deps" { | |
| 19 | 19 | assert(%%foo(1) == 0); |
| 20 | 20 | assert(%%foo(2) == 0); |
| 21 | 21 | } |
test/cases/math.zig+1-1| ... | ... | @@ -85,7 +85,7 @@ test "assignment operators" { |
| 85 | 85 | i |= 3; assert(i == 7); |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | test "threeExprInARow" { | |
| 88 | test "three expr in a row" { | |
| 89 | 89 | testThreeExprInARow(false, true); |
| 90 | 90 | comptime testThreeExprInARow(false, true); |
| 91 | 91 | } |
test/cases/namespace_depends_on_compile_var/index.zig+1-1| ... | ... | @@ -1,7 +1,7 @@ |
| 1 | 1 | const builtin = @import("builtin"); |
| 2 | 2 | const assert = @import("std").debug.assert; |
| 3 | 3 | |
| 4 | test "namespaceDependsOnCompileVar" { | |
| 4 | test "namespace depends on compile var" { | |
| 5 | 5 | if (some_namespace.a_bool) { |
| 6 | 6 | assert(some_namespace.a_bool); |
| 7 | 7 | } else { |
test/cases/null.zig+6-6| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | const assert = @import("std").debug.assert; |
| 2 | 2 | |
| 3 | test "nullableType" { | |
| 3 | test "nullable type" { | |
| 4 | 4 | const x : ?bool = true; |
| 5 | 5 | |
| 6 | 6 | if (x) |y| { |
| ... | ... | @@ -37,7 +37,7 @@ test "test maybe object and get a pointer to the inner value" { |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | |
| 40 | test "rhsMaybeUnwrapReturn" { | |
| 40 | test "rhs maybe unwrap return" { | |
| 41 | 41 | const x: ?bool = true; |
| 42 | 42 | const y = x ?? return; |
| 43 | 43 | } |
| ... | ... | @@ -61,7 +61,7 @@ fn foo(x: ?i32) -> ?bool { |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | |
| 64 | test "ifVarMaybePointer" { | |
| 64 | test "if var maybe pointer" { | |
| 65 | 65 | assert(shouldBeAPlus1(Particle {.a = 14, .b = 1, .c = 1, .d = 1}) == 15); |
| 66 | 66 | } |
| 67 | 67 | fn shouldBeAPlus1(p: &const Particle) -> u64 { |
| ... | ... | @@ -82,7 +82,7 @@ const Particle = struct { |
| 82 | 82 | }; |
| 83 | 83 | |
| 84 | 84 | |
| 85 | test "nullLiteralOutsideFunction" { | |
| 85 | test "null literal outside function" { | |
| 86 | 86 | const is_null = here_is_a_null_literal.context == null; |
| 87 | 87 | assert(is_null); |
| 88 | 88 | |
| ... | ... | @@ -97,7 +97,7 @@ const here_is_a_null_literal = SillyStruct { |
| 97 | 97 | }; |
| 98 | 98 | |
| 99 | 99 | |
| 100 | test "testNullRuntime" { | |
| 100 | test "test null runtime" { | |
| 101 | 101 | testTestNullRuntime(null); |
| 102 | 102 | } |
| 103 | 103 | fn testTestNullRuntime(x: ?i32) { |
| ... | ... | @@ -105,7 +105,7 @@ fn testTestNullRuntime(x: ?i32) { |
| 105 | 105 | assert(!(x != null)); |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | test "nullableVoid" { | |
| 108 | test "nullable void" { | |
| 109 | 109 | nullableVoidImpl(); |
| 110 | 110 | comptime nullableVoidImpl(); |
| 111 | 111 | } |
test/cases/pub_enum/index.zig+2-2| ... | ... | @@ -1,13 +1,13 @@ |
| 1 | 1 | const other = @import("other.zig"); |
| 2 | 2 | const assert = @import("std").debug.assert; |
| 3 | 3 | |
| 4 | test "pubEnum" { | |
| 4 | test "pub enum" { | |
| 5 | 5 | pubEnumTest(other.APubEnum.Two); |
| 6 | 6 | } |
| 7 | 7 | fn pubEnumTest(foo: other.APubEnum) { |
| 8 | 8 | assert(foo == other.APubEnum.Two); |
| 9 | 9 | } |
| 10 | 10 | |
| 11 | test "castWithImportedSymbol" { | |
| 11 | test "cast with imported symbol" { | |
| 12 | 12 | assert(other.size_t(42) == 42); |
| 13 | 13 | } |
test/cases/struct.zig+20-20| ... | ... | @@ -5,12 +5,12 @@ const StructWithNoFields = struct { |
| 5 | 5 | }; |
| 6 | 6 | const empty_global_instance = StructWithNoFields {}; |
| 7 | 7 | |
| 8 | test "callStructStaticMethod" { | |
| 8 | test "call struct static method" { | |
| 9 | 9 | const result = StructWithNoFields.add(3, 4); |
| 10 | 10 | assert(result == 7); |
| 11 | 11 | } |
| 12 | 12 | |
| 13 | test "returnEmptyStructInstance" { | |
| 13 | test "return empty struct instance" { | |
| 14 | 14 | _ = returnEmptyStructInstance(); |
| 15 | 15 | } |
| 16 | 16 | fn returnEmptyStructInstance() -> StructWithNoFields { |
| ... | ... | @@ -19,11 +19,11 @@ fn returnEmptyStructInstance() -> StructWithNoFields { |
| 19 | 19 | |
| 20 | 20 | const should_be_11 = StructWithNoFields.add(5, 6); |
| 21 | 21 | |
| 22 | test "invokeStaticMethodInGlobalScope" { | |
| 22 | test "invake static method in global scope" { | |
| 23 | 23 | assert(should_be_11 == 11); |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | test "voidStructFields" { | |
| 26 | test "void struct fields" { | |
| 27 | 27 | const foo = VoidStructFieldsFoo { |
| 28 | 28 | .a = void{}, |
| 29 | 29 | .b = 1, |
| ... | ... | @@ -39,7 +39,7 @@ const VoidStructFieldsFoo = struct { |
| 39 | 39 | }; |
| 40 | 40 | |
| 41 | 41 | |
| 42 | test "fn" { | |
| 42 | test "structs" { | |
| 43 | 43 | var foo: StructFoo = undefined; |
| 44 | 44 | @memset(@ptrCast(&u8, &foo), 0, @sizeOf(StructFoo)); |
| 45 | 45 | foo.a += 1; |
| ... | ... | @@ -70,7 +70,7 @@ const Val = struct { |
| 70 | 70 | x: i32, |
| 71 | 71 | }; |
| 72 | 72 | |
| 73 | test "structPointToSelf" { | |
| 73 | test "struct point to self" { | |
| 74 | 74 | var root : Node = undefined; |
| 75 | 75 | root.val.x = 1; |
| 76 | 76 | |
| ... | ... | @@ -83,7 +83,7 @@ test "structPointToSelf" { |
| 83 | 83 | assert(node.next.next.next.val.x == 1); |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | test "structByvalAssign" { | |
| 86 | test "struct byval assign" { | |
| 87 | 87 | var foo1 : StructFoo = undefined; |
| 88 | 88 | var foo2 : StructFoo = undefined; |
| 89 | 89 | |
| ... | ... | @@ -100,7 +100,7 @@ fn structInitializer() { |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | 102 | |
| 103 | test "fnCallOfStructField" { | |
| 103 | test "fn call of struct field" { | |
| 104 | 104 | assert(callStructField(Foo {.ptr = aFunc,}) == 13); |
| 105 | 105 | } |
| 106 | 106 | |
| ... | ... | @@ -115,7 +115,7 @@ fn callStructField(foo: &const Foo) -> i32 { |
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | |
| 118 | test "storeMemberFunctionInVariable" { | |
| 118 | test "store member function in variable" { | |
| 119 | 119 | const instance = MemberFnTestFoo { .x = 1234, }; |
| 120 | 120 | const memberFn = MemberFnTestFoo.member; |
| 121 | 121 | const result = memberFn(instance); |
| ... | ... | @@ -127,13 +127,13 @@ const MemberFnTestFoo = struct { |
| 127 | 127 | }; |
| 128 | 128 | |
| 129 | 129 | |
| 130 | test "callMemberFunctionDirectly" { | |
| 130 | test "call member function directly" { | |
| 131 | 131 | const instance = MemberFnTestFoo { .x = 1234, }; |
| 132 | 132 | const result = MemberFnTestFoo.member(instance); |
| 133 | 133 | assert(result == 1234); |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | test "memberFunctions" { | |
| 136 | test "member functions" { | |
| 137 | 137 | const r = MemberFnRand {.seed = 1234}; |
| 138 | 138 | assert(r.getSeed() == 1234); |
| 139 | 139 | } |
| ... | ... | @@ -144,7 +144,7 @@ const MemberFnRand = struct { |
| 144 | 144 | } |
| 145 | 145 | }; |
| 146 | 146 | |
| 147 | test "returnStructByvalFromFunction" { | |
| 147 | test "return struct byval from function" { | |
| 148 | 148 | const bar = makeBar(1234, 5678); |
| 149 | 149 | assert(bar.y == 5678); |
| 150 | 150 | } |
| ... | ... | @@ -159,7 +159,7 @@ fn makeBar(x: i32, y: i32) -> Bar { |
| 159 | 159 | } |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | test "emptyStructMethodCall" { | |
| 162 | test "empty struct method call" { | |
| 163 | 163 | const es = EmptyStruct{}; |
| 164 | 164 | assert(es.method() == 1234); |
| 165 | 165 | } |
| ... | ... | @@ -170,7 +170,7 @@ const EmptyStruct = struct { |
| 170 | 170 | }; |
| 171 | 171 | |
| 172 | 172 | |
| 173 | test "returnEmptyStructFromFn" { | |
| 173 | test "return empty struct from fn" { | |
| 174 | 174 | _ = testReturnEmptyStructFromFn(); |
| 175 | 175 | } |
| 176 | 176 | const EmptyStruct2 = struct {}; |
| ... | ... | @@ -178,7 +178,7 @@ fn testReturnEmptyStructFromFn() -> EmptyStruct2 { |
| 178 | 178 | EmptyStruct2 {} |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | test "passSliceOfEmptyStructToFn" { | |
| 181 | test "pass slice of empty struct to fn" { | |
| 182 | 182 | assert(testPassSliceOfEmptyStructToFn([]EmptyStruct2{ EmptyStruct2{} }) == 1); |
| 183 | 183 | } |
| 184 | 184 | fn testPassSliceOfEmptyStructToFn(slice: []const EmptyStruct2) -> usize { |
| ... | ... | @@ -190,7 +190,7 @@ const APackedStruct = packed struct { |
| 190 | 190 | y: u8, |
| 191 | 191 | }; |
| 192 | 192 | |
| 193 | test "packedStruct" { | |
| 193 | test "packed struct" { | |
| 194 | 194 | var foo = APackedStruct { |
| 195 | 195 | .x = 1, |
| 196 | 196 | .y = 2, |
| ... | ... | @@ -216,7 +216,7 @@ const bit_field_1 = BitField1 { |
| 216 | 216 | .c = 3, |
| 217 | 217 | }; |
| 218 | 218 | |
| 219 | test "bitFieldAccess" { | |
| 219 | test "bit field access" { | |
| 220 | 220 | var data = bit_field_1; |
| 221 | 221 | assert(getA(&data) == 1); |
| 222 | 222 | assert(getB(&data) == 2); |
| ... | ... | @@ -254,7 +254,7 @@ const Foo96Bits = packed struct { |
| 254 | 254 | d: u24, |
| 255 | 255 | }; |
| 256 | 256 | |
| 257 | test "packedStruct24Bits" { | |
| 257 | test "packed struct 24bits" { | |
| 258 | 258 | comptime { |
| 259 | 259 | assert(@sizeOf(Foo24Bits) == 3); |
| 260 | 260 | assert(@sizeOf(Foo96Bits) == 12); |
| ... | ... | @@ -297,7 +297,7 @@ const FooArray24Bits = packed struct { |
| 297 | 297 | c: u16, |
| 298 | 298 | }; |
| 299 | 299 | |
| 300 | test "packedArray24Bits" { | |
| 300 | test "packed array 24bits" { | |
| 301 | 301 | comptime { |
| 302 | 302 | assert(@sizeOf([9]Foo24Bits) == 9 * 3); |
| 303 | 303 | assert(@sizeOf(FooArray24Bits) == 2 + 2 * 3 + 2); |
| ... | ... | @@ -347,7 +347,7 @@ const FooArrayOfAligned = packed struct { |
| 347 | 347 | a: [2]FooStructAligned, |
| 348 | 348 | }; |
| 349 | 349 | |
| 350 | test "alignedArrayOfPackedStruct" { | |
| 350 | test "aligned array of packed struct" { | |
| 351 | 351 | comptime { |
| 352 | 352 | assert(@sizeOf(FooStructAligned) == 2); |
| 353 | 353 | assert(@sizeOf(FooArrayOfAligned) == 2 * 2); |
test/cases/switch_prong_err_enum.zig+1-1| ... | ... | @@ -21,7 +21,7 @@ fn doThing(form_id: u64) -> %FormValue { |
| 21 | 21 | } |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | test "switchProngReturnsErrorEnum" { | |
| 24 | test "switch prong returns error enum" { | |
| 25 | 25 | switch (%%doThing(17)) { |
| 26 | 26 | FormValue.Address => |payload| { assert(payload == 1); }, |
| 27 | 27 | else => unreachable, |
test/cases/switch_prong_implicit_cast.zig+1-1| ... | ... | @@ -15,7 +15,7 @@ fn foo(id: u64) -> %FormValue { |
| 15 | 15 | } |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | test "switchProngImplicitCast" { | |
| 18 | test "switch prong implicit cast" { | |
| 19 | 19 | const result = switch (%%foo(2)) { |
| 20 | 20 | FormValue.One => false, |
| 21 | 21 | FormValue.Two => |x| x, |
test/cases/this.zig+3-3| ... | ... | @@ -28,11 +28,11 @@ fn factorial(x: i32) -> i32 { |
| 28 | 28 | } |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | test "thisReferToModuleCallPrivateFn" { | |
| 31 | test "this refer to module call private fn" { | |
| 32 | 32 | assert(module.add(1, 2) == 3); |
| 33 | 33 | } |
| 34 | 34 | |
| 35 | test "thisReferToContainer" { | |
| 35 | test "this refer to container" { | |
| 36 | 36 | var pt = Point(i32) { |
| 37 | 37 | .x = 12, |
| 38 | 38 | .y = 34, |
| ... | ... | @@ -42,6 +42,6 @@ test "thisReferToContainer" { |
| 42 | 42 | assert(pt.y == 35); |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | test "thisReferToFn" { | |
| 45 | test "this refer to fn" { | |
| 46 | 46 | assert(factorial(5) == 120); |
| 47 | 47 | } |
test/cases/try.zig+2-2| ... | ... | @@ -1,6 +1,6 @@ |
| 1 | 1 | const assert = @import("std").debug.assert; |
| 2 | 2 | |
| 3 | test "tryOnErrorUnion" { | |
| 3 | test "try on error union" { | |
| 4 | 4 | tryOnErrorUnionImpl(); |
| 5 | 5 | comptime tryOnErrorUnionImpl(); |
| 6 | 6 | |
| ... | ... | @@ -24,7 +24,7 @@ fn returnsTen() -> %i32 { |
| 24 | 24 | 10 |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | test "tryWithoutVars" { | |
| 27 | test "try without vars" { | |
| 28 | 28 | const result1 = if (failIfTrue(true)) { |
| 29 | 29 | 1 |
| 30 | 30 | } else |_| { |
test/cases/undefined.zig+3-3| ... | ... | @@ -9,7 +9,7 @@ fn initStaticArray() -> [10]i32 { |
| 9 | 9 | return array; |
| 10 | 10 | } |
| 11 | 11 | const static_array = initStaticArray(); |
| 12 | test "initStaticArrayToUndefined" { | |
| 12 | test "init static array to undefined" { | |
| 13 | 13 | assert(static_array[0] == 1); |
| 14 | 14 | assert(static_array[4] == 2); |
| 15 | 15 | assert(static_array[7] == 3); |
| ... | ... | @@ -35,7 +35,7 @@ fn setFooX(foo: &Foo) { |
| 35 | 35 | foo.x = 2; |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | test "assignUndefinedToStruct" { | |
| 38 | test "assign undefined to struct" { | |
| 39 | 39 | comptime { |
| 40 | 40 | var foo: Foo = undefined; |
| 41 | 41 | setFooX(&foo); |
| ... | ... | @@ -48,7 +48,7 @@ test "assignUndefinedToStruct" { |
| 48 | 48 | } |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | test "assignUndefinedToStructWithMethod" { | |
| 51 | test "assign undefined to struct with method" { | |
| 52 | 52 | comptime { |
| 53 | 53 | var foo: Foo = undefined; |
| 54 | 54 | foo.setFooXMethod(); |
test/cases/var_args.zig+3-3| ... | ... | @@ -8,7 +8,7 @@ fn add(args: ...) -> i32 { |
| 8 | 8 | return sum; |
| 9 | 9 | } |
| 10 | 10 | |
| 11 | test "testAddArbitraryArgs" { | |
| 11 | test "add arbitrary args" { | |
| 12 | 12 | assert(add(i32(1), i32(2), i32(3), i32(4)) == 10); |
| 13 | 13 | assert(add(i32(1234)) == 1234); |
| 14 | 14 | assert(add() == 0); |
| ... | ... | @@ -18,11 +18,11 @@ fn readFirstVarArg(args: ...) { |
| 18 | 18 | const value = args[0]; |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | test "sendVoidArgToVarArgs" { | |
| 21 | test "send void arg to var args" { | |
| 22 | 22 | readFirstVarArg({}); |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | test "testPassArgsDirectly" { | |
| 25 | test "pass args directly" { | |
| 26 | 26 | assert(addSomeStuff(i32(1), i32(2), i32(3), i32(4)) == 10); |
| 27 | 27 | assert(addSomeStuff(i32(1234)) == 1234); |
| 28 | 28 | assert(addSomeStuff() == 0); |
test/cases/void.zig+1-1| ... | ... | @@ -6,7 +6,7 @@ const Foo = struct { |
| 6 | 6 | c: void, |
| 7 | 7 | }; |
| 8 | 8 | |
| 9 | test "compareVoidWithVoidCompileTimeKnown" { | |
| 9 | test "compare void with void compile time known" { | |
| 10 | 10 | comptime { |
| 11 | 11 | const foo = Foo { |
| 12 | 12 | .a = {}, |