Skip to content

Commit

Permalink
expandArray: Move ForcedInputRange example into undocumented test
Browse files Browse the repository at this point in the history
ForcedInputRange is private.
  • Loading branch information
ntrel committed Sep 5, 2016
1 parent 2854ae0 commit 46d281b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion std/experimental/allocator/package.d
Expand Up @@ -1395,13 +1395,17 @@ unittest
import std.range : only;
assert(theAllocator.expandArray(arr, only(4, 5)));
assert(arr == [1, 2, 3, 0, 0, 4, 5]);
}

unittest
{
auto arr = theAllocator.makeArray!int([1, 2, 3]);
ForcedInputRange r;
int[] b = [ 1, 2, 3, 4 ];
auto temp = b;
r.array = &temp;
assert(theAllocator.expandArray(arr, r));
assert(arr == [1, 2, 3, 0, 0, 4, 5, 1, 2, 3, 4]);
assert(arr == [1, 2, 3, 1, 2, 3, 4]);
}

/**
Expand Down

0 comments on commit 46d281b

Please sign in to comment.