-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixed bug with incorrect classification of function which return Not…
…hing as unshiftable
- Loading branch information
Showing
7 changed files
with
77 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 33 additions & 0 deletions
33
shared/src/test/scala/cpstest/TestRunFailInsideAwait.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package cpstest; | ||
|
||
import scala.concurrent.Future | ||
import scala.concurrent.ExecutionContext.Implicits.global | ||
import org.junit.Test | ||
|
||
import cps.* | ||
import cps.monads.{*,given} | ||
|
||
import cps.testconfig.given | ||
import cps.util.FutureCompleter | ||
|
||
|
||
class TestRunFailInsideAwait { | ||
|
||
@Test | ||
def testFailInsideAwait() = { | ||
val c = async[Future] { | ||
val list0 = List(1, 2, 3, 4, 5) | ||
try { | ||
val list1 = list0.map[Int](x => await(Future.failed(new RuntimeException("test")))) | ||
assert(false) | ||
1 | ||
} catch { | ||
case ex: RuntimeException => | ||
assert(ex.getMessage() == "test") | ||
2 | ||
} | ||
} | ||
FutureCompleter(c.map(x => assert(x == 2))) | ||
} | ||
|
||
} |