From 19bfe3e6292d79ad4c7a5f72d0bedf6108be1171 Mon Sep 17 00:00:00 2001 From: "Yang, Bo" Date: Wed, 24 Nov 2021 23:18:50 -0800 Subject: [PATCH] Add a test for Return --- .../com/thoughtworks/dsl/keywords/AwaitTest.scala | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/keywords-Await/src/test/scala/com/thoughtworks/dsl/keywords/AwaitTest.scala b/keywords-Await/src/test/scala/com/thoughtworks/dsl/keywords/AwaitTest.scala index 691cc9527..53bed1c24 100644 --- a/keywords-Await/src/test/scala/com/thoughtworks/dsl/keywords/AwaitTest.scala +++ b/keywords-Await/src/test/scala/com/thoughtworks/dsl/keywords/AwaitTest.scala @@ -15,6 +15,18 @@ import scala.language.dynamics import org.hamcrest.CoreMatchers.instanceOf class AwaitTest { + + @Test + def testReturnIf: Unit = { + val reified = reify { + if (true) { + !Return(!Await(Future(42))) + } + -1 + } + assertEquals(42, result(reified.to[Future], Duration.Inf)) + } + type Id[A] = A @Test