summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2017-06-15 10:37:50 +0200
committerEugen Wissner <belka@caraus.de>2017-06-15 10:37:50 +0200
commit3789853d989476c72357ad3c414aeae8c0c96e1b (patch)
tree0dd08779342be0847caa983379ab8b7cfbcee7d9 /source
parentf0d016bcde823ab65e29028dd4b82ad2de41baff (diff)
downloadtanya-3789853d989476c72357ad3c414aeae8c0c96e1b.tar.gz
Fix one Mallocator test
Test that if the reallocation fails, the pointer doesn't change.
Diffstat (limited to 'source')
-rw-r--r--source/tanya/memory/mallocator.d5
1 files changed, 4 insertions, 1 deletions
diff --git a/source/tanya/memory/mallocator.d b/source/tanya/memory/mallocator.d
index 9e0f5fb..0c86e9d 100644
--- a/source/tanya/memory/mallocator.d
+++ b/source/tanya/memory/mallocator.d
@@ -154,8 +154,11 @@ final class Mallocator : Allocator
// Fails with false.
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(oldP is p);
+ Mallocator.instance.deallocate(p);
}
/**