What is the === (triple-equals) operator in Scala Koans?

后端 未结 1 1352
天涯浪人
天涯浪人 2020-12-29 01:13

I started working my way through the Scala Koans, which is organized around a suite of unit tests with blanks that one needs to fill in. (This idea was modeled after a simi

相关标签:
1条回答
  • 2020-12-29 01:38

    This is the triple-equals operator from ScalaTest. Have a look at this page: Getting Started with FunSuite. It says:

    ScalaTest lets you use Scala's assertion syntax, but defines a triple equals operator (===) to give you better error messages. The following code would give you an error indicating only that an assertion failed:

    assert(1 == 2)
    

    Using triple equals instead would give you the more informative error message, "1 did not equal 2":

    assert(1 === 2)
    
    0 讨论(0)
提交回复
热议问题