Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion test-tests/shared/src/test/scala/zio/test/AssertionSpec.scala
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package zio.test

import zio.test.Assertion._
import zio.{Chunk, Exit}
import zio.{Chunk, Exit, ZIO}

import scala.collection.immutable.SortedSet
import scala.util.{Failure, Success}
Expand Down Expand Up @@ -48,6 +48,14 @@ object AssertionSpec extends ZIOBaseSpec {
test("diesWithA must succeed when given type assertion is correct") {
assert(Exit.die(customException))(diesWithA[CustomException])
},
test("diesWithA must be agnostic to failure type") {
assertZIO(
ZIO
.die(customException)
.flatMap(_ => ZIO.fromEither(Right[String, List[Int]](List(1, 2, 3))))
.exit
)(diesWithA[CustomException])
},
test("endWith must succeed when the supplied value ends with the specified sequence") {
assert(List(1, 2, 3, 4, 5))(endsWith(List(3, 4, 5)))
},
Expand Down
2 changes: 1 addition & 1 deletion test/shared/src/main/scala/zio/test/Assertion.scala
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ object Assertion extends AssertionVariants {
* Makes a new assertion that requires an exit value to die with an instance
* of given type (or its subtype).
*/
def diesWithA[E: ClassTag]: Assertion[Exit[E, Any]] =
def diesWithA[E: ClassTag]: Assertion[Exit[Any, Any]] =
dies(isSubtype[E](anything))

/**
Expand Down