diff --git a/jvm/diagrams-test/src/test/scala/org/scalatest/diagrams/DiagramsSpec.scala b/jvm/diagrams-test/src/test/scala/org/scalatest/diagrams/DiagramsSpec.scala index 643ac93f69..b1953901bd 100644 --- a/jvm/diagrams-test/src/test/scala/org/scalatest/diagrams/DiagramsSpec.scala +++ b/jvm/diagrams-test/src/test/scala/org/scalatest/diagrams/DiagramsSpec.scala @@ -23,9 +23,11 @@ import org.scalatest.exceptions.TestFailedException import org.scalatest.funspec.AnyFunSpec import org.scalatest.matchers.should.Matchers +// SKIP-SCALATESTJS,NATIVE-START import scala.concurrent.ExecutionContext.Implicits.global import scala.concurrent.duration.{Duration, SECONDS} import scala.concurrent.{Await, Future} +// SKIP-SCALATESTJS,NATIVE-END class DiagramsSpec extends AnyFunSpec with Matchers with Diagrams { diff --git a/jvm/diagrams-test/src/test/scala/org/scalatest/diagrams/DirectDiagrammedAssertionsSpec.scala b/jvm/diagrams-test/src/test/scala/org/scalatest/diagrams/DirectDiagrammedAssertionsSpec.scala index 060d2ea6ef..526e875f1b 100644 --- a/jvm/diagrams-test/src/test/scala/org/scalatest/diagrams/DirectDiagrammedAssertionsSpec.scala +++ b/jvm/diagrams-test/src/test/scala/org/scalatest/diagrams/DirectDiagrammedAssertionsSpec.scala @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -/*package org.scalatest.diagrams +package org.scalatest.diagrams import org.scalatest.SharedHelpers.thisLineNumber import java.util.Date @@ -22,6 +22,12 @@ import org.scalatest.exceptions.TestCanceledException import org.scalatest.exceptions.TestFailedException import org.scalatest.funspec.AnyFunSpec +// SKIP-SCALATESTJS,NATIVE-START +import scala.concurrent.ExecutionContext.Implicits.global +import scala.concurrent.duration.{Duration, SECONDS} +import scala.concurrent.{Await, Future} +// SKIP-SCALATESTJS,NATIVE-END + class DirectDiagrammedAssertionsSpec extends AnyFunSpec with org.scalatest.matchers.should.Matchers { val fileName: String = "DirectDiagrammedAssertionsSpec.scala" @@ -2584,6 +2590,15 @@ class DirectDiagrammedAssertionsSpec extends AnyFunSpec with org.scalatest.match |org.scalatest.diagrams.Diagrams.assert(java.math.BigInteger.ZERO == java.math.BigInteger.ZERO) """.stripMargin) } + + // scala js and native does not support Await.result + // SKIP-SCALATESTJS,NATIVE-START + it("should invoke future one time only") { + var count = 0 + org.scalatest.diagrams.Diagrams.assert(Await.result(Future { count = count + 1; 42 }, Duration(1, SECONDS)) == 42) + count shouldBe 1 + } + // SKIP-SCALATESTJS,NATIVE-END } describe("The org.scalatest.diagrams.Diagrams.assert(boolean, clue) method") { @@ -5042,6 +5057,15 @@ class DirectDiagrammedAssertionsSpec extends AnyFunSpec with org.scalatest.match |org.scalatest.diagrams.Diagrams.assert(java.math.BigDecimal.ZERO == java.math.BigDecimal.ZERO, "this is a clue") """.stripMargin) } + + // scala js and native does not support Await.result + // SKIP-SCALATESTJS,NATIVE-START + it("should invoke future one time only") { + var count = 0 + org.scalatest.diagrams.Diagrams.assert(Await.result(Future { count = count + 1; 42 }, Duration(1, SECONDS)) == 42, "this is a clue") + count shouldBe 1 + } + // SKIP-SCALATESTJS,NATIVE-END } describe("The org.scalatest.diagrams.Diagrams.assume(boolean) method") { @@ -7500,6 +7524,15 @@ class DirectDiagrammedAssertionsSpec extends AnyFunSpec with org.scalatest.match |org.scalatest.diagrams.Diagrams.assume(java.math.BigDecimal.ZERO == java.math.BigDecimal.ZERO) """.stripMargin) } + + // scala js and native does not support Await.result + // SKIP-SCALATESTJS,NATIVE-START + it("should invoke future one time only") { + var count = 0 + org.scalatest.diagrams.Diagrams.assume(Await.result(Future { count = count + 1; 42 }, Duration(1, SECONDS)) == 42) + count shouldBe 1 + } + // SKIP-SCALATESTJS,NATIVE-END } describe("The org.scalatest.diagrams.Diagrams.assume(boolean, clue) method") { @@ -9958,9 +9991,18 @@ class DirectDiagrammedAssertionsSpec extends AnyFunSpec with org.scalatest.match |org.scalatest.diagrams.Diagrams.assume(java.math.BigDecimal.ZERO == java.math.BigDecimal.ZERO, "this is a clue") """.stripMargin) } + + // scala js and native does not support Await.result + // SKIP-SCALATESTJS,NATIVE-START + it("should invoke future one time only") { + var count = 0 + org.scalatest.diagrams.Diagrams.assume(Await.result(Future { count = count + 1; 42 }, Duration(1, SECONDS)) == 42, "this is a clue") + count shouldBe 1 + } + // SKIP-SCALATESTJS,NATIVE-END } } -}*/ +}