david.perez
david.perez

Reputation: 7012

How to use the === syntax from Specs2 in ScalaTest

I really like this syntax from Specs2 in order to test for equality:

1 + 1 === 2

instead of:

assert(1+1 == 2)

or the English-like synonims.

Can this syntax also be used in ScalaTest?

Here is the list of matchers that ScalaTest and Specs2 supports.

Upvotes: 0

Views: 72

Answers (2)

pagoda_5b
pagoda_5b

Reputation: 7373

ScalaTest already supports this operator in trait TripleEqualsSupport

Here is the scaladoc reference for the current version

Upvotes: 0

johanandren
johanandren

Reputation: 11479

It is described as supported in the docs of ScalaTest, so yes:

http://www.scalatest.org/user_guide/using_matchers#checkingEqualityWithMatchers

result should === (3)   // can customize equality and enforce type constraints

Upvotes: 1

Related Questions