Skip to content

Commit fb9f86f

Browse files
committed
union tests for scala 3
1 parent 5de654a commit fb9f86f

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tests/shared/src/test/scala-3/cats/mtl/tests/Handle3Tests.scala

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,18 @@ class Handle3Tests extends munit.FunSuite:
5757
case Error1.Second => "second1".pure[F]
5858
case Error1.Third => "third1".pure[F]
5959
assert.equals(test.value.value.toOption, Some("third1"))
60+
61+
test("submerge two independent errors with union(scala 3)"):
62+
enum Error1:
63+
case First, Second, Third
64+
enum Error2:
65+
case Fourth
66+
val test =
67+
allow[Error1 | Error2]:
68+
Error1.Third.raise[F, String].as("nope")
69+
.rescue:
70+
case Error1.First => "first1".pure[F]
71+
case Error1.Second => "second1".pure[F]
72+
case Error1.Third => "third1".pure[F]
73+
case Error2.Fourth => "fourth1".pure[F]
74+
assert.equals(test.value.value.toOption, Some("third1"))

0 commit comments

Comments
 (0)