aboutsummaryrefslogtreecommitdiff
path: root/lib/std/array_list.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2020-02-13 16:17:21 -0500
committerGitHub <noreply@github.com>2020-02-13 16:17:21 -0500
commite8dfc5e7f615c0c8a529623560d6adc3dc029c1b (patch)
tree5f852c0a8cde55562d2fe86db81b745e9ffb4f1b /lib/std/array_list.zig
parentde23c571334b6df172751f45e6eda02a138f7cdf (diff)
parenta81ae1223d4ea4aea689fc8a03004abfb865a884 (diff)
downloadzig-e8dfc5e7f615c0c8a529623560d6adc3dc029c1b.tar.gz
zig-e8dfc5e7f615c0c8a529623560d6adc3dc029c1b.zip
Merge pull request #4442 from fengb/testing-allocator-calls
Migrate tests from FixedBufferAllocator to testing.allocator
Diffstat (limited to 'lib/std/array_list.zig')
-rw-r--r--lib/std/array_list.zig14
1 files changed, 3 insertions, 11 deletions
diff --git a/lib/std/array_list.zig b/lib/std/array_list.zig
index b028390465..f212ae8659 100644
--- a/lib/std/array_list.zig
+++ b/lib/std/array_list.zig
@@ -244,10 +244,7 @@ pub fn AlignedArrayList(comptime T: type, comptime alignment: ?u29) type {
}
test "std.ArrayList.init" {
- var bytes: [1024]u8 = undefined;
- const allocator = &std.heap.FixedBufferAllocator.init(bytes[0..]).allocator;
-
- var list = ArrayList(i32).init(allocator);
+ var list = ArrayList(i32).init(testing.allocator);
defer list.deinit();
testing.expect(list.len == 0);
@@ -255,19 +252,14 @@ test "std.ArrayList.init" {
}
test "std.ArrayList.initCapacity" {
- var bytes: [1024]u8 = undefined;
- const allocator = &std.heap.FixedBufferAllocator.init(bytes[0..]).allocator;
- var list = try ArrayList(i8).initCapacity(allocator, 200);
+ var list = try ArrayList(i8).initCapacity(testing.allocator, 200);
defer list.deinit();
testing.expect(list.len == 0);
testing.expect(list.capacity() >= 200);
}
test "std.ArrayList.basic" {
- var bytes: [1024]u8 = undefined;
- const allocator = &std.heap.FixedBufferAllocator.init(bytes[0..]).allocator;
-
- var list = ArrayList(i32).init(allocator);
+ var list = ArrayList(i32).init(testing.allocator);
defer list.deinit();
// setting on empty list is out of bounds