diff --git a/src/Magnum/Audio/Test/ContextTest.cpp b/src/Magnum/Audio/Test/ContextTest.cpp index a2b0381b6..d5b8ef8f7 100644 --- a/src/Magnum/Audio/Test/ContextTest.cpp +++ b/src/Magnum/Audio/Test/ContextTest.cpp @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -84,8 +85,13 @@ void ContextTest::extensions() { CORRADE_FAIL_IF(e.index() >= Implementation::ExtensionCount, "Index" << e.index() << "larger than" << Implementation::ExtensionCount); + /* Have to use Containers::StringView to avoid passing null char* to + std::cout (which crashes on Mac due to strlen being called on it) + because the message is actually printed sooner than the condition + gets tested! */ + /** @todo clean up once fixed in Corrade */ CORRADE_FAIL_IF(used[e.index()], - "Index" << e.index() << "already used by" << used[e.index()]); + "Index" << e.index() << "already used by" << Containers::StringView{used[e.index()]}); used[e.index()] = e.string(); CORRADE_FAIL_IF(!unique.insert(e.string()).second, diff --git a/src/Magnum/GL/Test/ContextTest.cpp b/src/Magnum/GL/Test/ContextTest.cpp index 4ff1b45ef..af5c0132a 100644 --- a/src/Magnum/GL/Test/ContextTest.cpp +++ b/src/Magnum/GL/Test/ContextTest.cpp @@ -406,8 +406,13 @@ void ContextTest::extensions() { CORRADE_FAIL_IF(e.index() >= GL::Implementation::ExtensionCount, "Index" << e.index() << "larger than" << GL::Implementation::ExtensionCount); + /* Have to use Containers::StringView to avoid passing null char* + to std::cout (which crashes on Mac due to strlen being called on + it) because the message is actually printed sooner than the + condition gets tested! */ + /** @todo clean up once fixed in Corrade */ CORRADE_FAIL_IF(used[e.index()], - "Index" << e.index() << "already used by" << used[e.index()]); + "Index" << e.index() << "already used by" << Containers::StringView{used[e.index()]}); used[e.index()] = e.string(); CORRADE_FAIL_IF(!unique.insert(e.string()).second,