From 22cc47427d3d7f46aa41ac963b9e96e9cde870bf Mon Sep 17 00:00:00 2001 From: Natsu Kagami Date: Wed, 25 Oct 2023 14:57:44 +0200 Subject: [PATCH] Use a package proxy for `scalanative.runtime.loop` ... since it is becoming package-private from v0.5 onwards. --- .../src/main/scala/munit/internal/PlatformCompat.scala | 2 +- munit/native/src/main/scala/scalanative/munit/package.scala | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 munit/native/src/main/scala/scalanative/munit/package.scala diff --git a/munit/native/src/main/scala/munit/internal/PlatformCompat.scala b/munit/native/src/main/scala/munit/internal/PlatformCompat.scala index 9ddbd8e3..736f89a4 100644 --- a/munit/native/src/main/scala/munit/internal/PlatformCompat.scala +++ b/munit/native/src/main/scala/munit/internal/PlatformCompat.scala @@ -14,7 +14,7 @@ import scala.concurrent.ExecutionContext object PlatformCompat { def awaitResult[T](awaitable: Awaitable[T]): T = { - scalanative.runtime.loop() + scalanative.runtime.munit.drainExecutionContext() Await.result(awaitable, Duration.Inf) } diff --git a/munit/native/src/main/scala/scalanative/munit/package.scala b/munit/native/src/main/scala/scalanative/munit/package.scala new file mode 100644 index 00000000..abbe4ad7 --- /dev/null +++ b/munit/native/src/main/scala/scalanative/munit/package.scala @@ -0,0 +1,6 @@ +package scala.scalanative.runtime + +package object munit { + /** Drains the execution context by executing all pending tasks. */ + def drainExecutionContext(): Unit = loop() +}