diff --git a/kotlin-native/runtime/src/mm/cpp/TestSupport.cpp b/kotlin-native/runtime/src/mm/cpp/TestSupport.cpp index 0c542b101f1..db374abad28 100644 --- a/kotlin-native/runtime/src/mm/cpp/TestSupport.cpp +++ b/kotlin-native/runtime/src/mm/cpp/TestSupport.cpp @@ -11,6 +11,7 @@ #include "GlobalsRegistry.hpp" #include "TestSupport.hpp" #include "ThreadData.hpp" +#include "ThreadState.hpp" using namespace kotlin; @@ -57,4 +58,8 @@ extern "C" void Kotlin_TestSupport_AssertClearGlobalState() { void kotlin::DeinitMemoryForTests(MemoryState* memoryState) { DeinitMemory(memoryState, false); mm::ThreadRegistry::TestSupport::ClearCurrentThreadData(); +} + +std::ostream& kotlin::operator<<(std::ostream& stream, ThreadState state) { + return stream << ThreadStateName(state); } \ No newline at end of file diff --git a/kotlin-native/runtime/src/mm/cpp/TestSupport.hpp b/kotlin-native/runtime/src/mm/cpp/TestSupport.hpp index ec8c6bc65bf..4a6c06456d1 100644 --- a/kotlin-native/runtime/src/mm/cpp/TestSupport.hpp +++ b/kotlin-native/runtime/src/mm/cpp/TestSupport.hpp @@ -5,6 +5,8 @@ #include "../../main/cpp/TestSupport.hpp" +#include + #include "MemoryPrivate.hpp" #include "ThreadData.hpp" @@ -16,4 +18,8 @@ inline void RunInNewThread(std::function f) { }); } +// Overload the << operator for ThreadState to allow the GTest runner +// to pretty print ThreadState constants. +std::ostream& operator<<(std::ostream& stream, ThreadState state); + } // namespace kotlin