aboutsummaryrefslogtreecommitdiff
path: root/test/cases/array.zig
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2017-03-16 16:02:35 -0400
committerAndrew Kelley <superjoe30@gmail.com>2017-03-16 16:02:35 -0400
commitaf536ac343564e5120f99cbf3b7fc9efa984eb93 (patch)
tree42a937bca75d34e2d3b4fc7d44ebafa66d8bd55b /test/cases/array.zig
parent329457bb4f714a8392153dfecfabd6f356144688 (diff)
downloadzig-af536ac343564e5120f99cbf3b7fc9efa984eb93.tar.gz
zig-af536ac343564e5120f99cbf3b7fc9efa984eb93.zip
introduce new test syntax
* remove setFnTest builtin * add test "name" { ... } syntax * remove --check-unused argument. functions are always lazy now.
Diffstat (limited to 'test/cases/array.zig')
-rw-r--r--test/cases/array.zig24
1 files changed, 6 insertions, 18 deletions
diff --git a/test/cases/array.zig b/test/cases/array.zig
index 3b91efbc20..789e549c55 100644
--- a/test/cases/array.zig
+++ b/test/cases/array.zig
@@ -1,9 +1,7 @@
const assert = @import("std").debug.assert;
const mem = @import("std").mem;
-fn arrays() {
- @setFnTest(this);
-
+test "arrays" {
var array : [5]u32 = undefined;
var i : u32 = 0;
@@ -27,9 +25,7 @@ fn getArrayLen(a: []const u32) -> usize {
a.len
}
-fn voidArrays() {
- @setFnTest(this);
-
+test "voidArrays" {
var array: [4]void = undefined;
array[0] = void{};
array[1] = array[2];
@@ -37,18 +33,14 @@ fn voidArrays() {
assert(array.len == 4);
}
-fn arrayLiteral() {
- @setFnTest(this);
-
+test "arrayLiteral" {
const hex_mult = []u16{4096, 256, 16, 1};
assert(hex_mult.len == 4);
assert(hex_mult[1] == 256);
}
-fn arrayDotLenConstExpr() {
- @setFnTest(this);
-
+test "arrayDotLenConstExpr" {
assert(comptime {some_array.len == 4});
}
@@ -58,9 +50,7 @@ const ArrayDotLenConstExpr = struct {
const some_array = []u8 {0, 1, 2, 3};
-fn nestedArrays() {
- @setFnTest(this);
-
+test "nestedArrays" {
const array_of_strings = [][]const u8 {"hello", "this", "is", "my", "thing"};
for (array_of_strings) |s, i| {
if (i == 0) assert(mem.eql(u8, s, "hello"));
@@ -79,9 +69,7 @@ const Sub = struct {
const Str = struct {
a: []Sub,
};
-fn setGlobalVarArrayViaSliceEmbeddedInStruct() {
- @setFnTest(this);
-
+test "setGlobalVarArrayViaSliceEmbeddedInStruct" {
var s = Str { .a = s_array[0...]};
s.a[0].b = 1;