Fix one Mallocator test

Test that if the reallocation fails, the pointer doesn't change.
This commit is contained in:
Eugen Wissner 2017-06-15 10:37:50 +02:00
parent f0d016bcde
commit 3789853d98

View File

@ -154,8 +154,11 @@ final class Mallocator : Allocator
// Fails with false. // Fails with false.
private @nogc nothrow unittest private @nogc nothrow unittest
{ {
void[] p; void[] p = Mallocator.instance.allocate(20);
void[] oldP = p;
assert(!Mallocator.instance.reallocate(p, size_t.max - Mallocator.psize * 2)); assert(!Mallocator.instance.reallocate(p, size_t.max - Mallocator.psize * 2));
assert(oldP is p);
Mallocator.instance.deallocate(p);
} }
/** /**