From 9bd2a5a5eef541a52fc52e9b9cd6116ae9309f7d Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Wed, 21 Apr 2021 01:03:09 -0500 Subject: [PATCH] [ox/fs] Fix broken test that was hidden because of bad asserts --- deps/ox/src/ox/fs/test/tests.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/deps/ox/src/ox/fs/test/tests.cpp b/deps/ox/src/ox/fs/test/tests.cpp index 20265b4f..acb7c250 100644 --- a/deps/ox/src/ox/fs/test/tests.cpp +++ b/deps/ox/src/ox/fs/test/tests.cpp @@ -38,8 +38,12 @@ const std::map> tes auto a2 = buffer->malloc(sizeof(String)); oxAssert(a1.valid(), "Allocation 1 failed."); oxAssert(a2.valid(), "Allocation 2 failed."); - auto &s1 = *new (buffer->dataOf(a1)) String("asdf"); - auto &s2 = *new (buffer->dataOf(a2)) String("aoeu"); + auto s1Buff = buffer->dataOf(a1); + auto s2Buff = buffer->dataOf(a2); + oxAssert(s1Buff.valid(), "s1 allocation 1 failed."); + oxAssert(s2Buff.valid(), "s2 allocation 2 failed."); + auto &s1 = *new (s1Buff) String("asdf"); + auto &s2 = *new (s2Buff) String("aoeu"); oxTrace("test") << "s1: " << s1.c_str(); oxTrace("test") << "s2: " << s2.c_str(); oxAssert(s1 == "asdf", "Allocation 1 not as expected.");