Create a gist now

Instantly share code, notes, and snippets.

Embed
ScalaTest Assertions and Diagrammed Assertions
scala> import org.scalatest.Assertions._
import org.scalatest.Assertions._
scala> val x = 1
x: Int = 1
scala> assert(List(1, 2, 3).contains(x) && x > 1)
org.scalatest.exceptions.TestFailedException: List(1, 2, 3) contained 1, but 1 was not greater than 1
at org.scalatest.Assertions$class.newAssertionFailedException(Assertions.scala:541)
at org.scalatest.Assertions$.newAssertionFailedException(Assertions.scala:1414)
at org.scalatest.Assertions$AssertionsHelper.macroAssert(Assertions.scala:506)
... 43 elided
scala> import org.scalatest.DiagrammedAssertions._
import org.scalatest.DiagrammedAssertions._
scala> assert(List(1, 2, 3).contains(x) && x > 1)
org.scalatest.exceptions.TestFailedException:
assert(List(1, 2, 3).contains(x) && x > 1)
| | | | | | | | | |
| 1 2 3 true 1 | 1 | 1
List(1, 2, 3) | false
false
at org.scalatest.Assertions$class.newAssertionFailedException(Assertions.scala:541)
at org.scalatest.DiagrammedAssertions$.newAssertionFailedException(DiagrammedAssertions.scala:390)
at org.scalatest.DiagrammedAssertions$DiagrammedAssertionsHelper.macroAssert(DiagrammedAssertions.scala:246)
... 43 elided
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment