aboutsummaryrefslogtreecommitdiff
path: root/std
diff options
context:
space:
mode:
authorkristopher tate <kris.tate+github@gmail.com>2018-12-20 22:49:09 +0900
committerkristopher tate <kris.tate+github@gmail.com>2018-12-20 22:53:54 +0900
commitfb81b1978b87be5a72328a4d9efc21561ae53cfc (patch)
tree69c5ba9a62c4bea4fd2c3b9e895575fa84e4d956 /std
parent39567e8b50e9026288bb1323d84f481740bd0de7 (diff)
downloadzig-fb81b1978b87be5a72328a4d9efc21561ae53cfc.tar.gz
zig-fb81b1978b87be5a72328a4d9efc21561ae53cfc.zip
tests: re: 79db394;
ref: ziglang/zig#1832
Diffstat (limited to 'std')
-rw-r--r--std/array_list.zig11
1 files changed, 11 insertions, 0 deletions
diff --git a/std/array_list.zig b/std/array_list.zig
index 3ee425fe14..ddad9c989c 100644
--- a/std/array_list.zig
+++ b/std/array_list.zig
@@ -398,3 +398,14 @@ test "std.ArrayList.insertSlice" {
assert(list.len == 6);
assert(list.items[0] == 1);
}
+
+const Item = struct {
+ integer: i32,
+ sub_items: ArrayList(Item),
+};
+
+test "std.ArrayList: ArrayList(T) of struct T" {
+ var root = Item{ .integer = 1, .sub_items = ArrayList(Item).init(debug.global_allocator) };
+ try root.sub_items.append( Item{ .integer = 42, .sub_items = ArrayList(Item).init(debug.global_allocator) } );
+ assert(root.sub_items.items[0].integer == 42);
+}