All Downloads are FREE. Search and download functionalities are using the official Maven repository.

test_sjs0.6_2.11.0.4.3.source-code.PlatformShims.scala Maven / Gradle / Ivy

There is a newer version: 0.7.11
Show newest version
package utest


import scala.concurrent.Future
import scala.scalajs.js
import scala.scalajs.js.annotation.{JSExport, JSExportDescendentObjects}
import scala.scalajs.runtime.StackTrace.ColumnStackTraceElement
import scala.util.{Failure, Success}

/**
 * Platform specific stuff that differs between JVM and JS
 */
@JSExport
object PlatformShims {
  def await[T](f: Future[T]): T = {
    f.value match {
      case Some(v) => v.get
      case None => throw new IllegalStateException(
        "Test that returns Future must be run asynchronously in Scala.js, see TestTreeSeq::runAsync"
      )
    }
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy