diff options
Diffstat (limited to 'test/files/jvm/try-type-tests.scala')
-rw-r--r-- | test/files/jvm/try-type-tests.scala | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/files/jvm/try-type-tests.scala b/test/files/jvm/try-type-tests.scala index 9dece8d6d8..351f02b183 100644 --- a/test/files/jvm/try-type-tests.scala +++ b/test/files/jvm/try-type-tests.scala @@ -103,6 +103,20 @@ trait TryStandard { } } + def testSuccessTransform(): Unit = { + val s = Success(1) + val succ = (x: Int) => Success(x * 10) + val fail = (x: Throwable) => Success(0) + assert(s.transform(succ, fail).get == s.get) + } + + def testFailureTransform(): Unit = { + val f = Failure(new Exception("foo")) + val succ = (x: Int) => Success(x * 10) + val fail = (x: Throwable) => Success(0) + assert(f.transform(succ, fail).get == 0) + } + testForeachSuccess() testForeachFailure() testFlatMapSuccess() |