2

How can I do something like this? Check for two conditions while testing

// b is Option[Array[Int]]
b should be ('empty) || b.get should be ('empty)

I want to do it using ShouldMatchers instead of assert, since ShouldMatchers is part of scalatest.

Anish Shah
  • 7,669
  • 8
  • 29
  • 40

1 Answers1

2

You should be able to do

val b: Option[Array[Int]] = ???
b should (be ('empty) or be (Some(Array.empty[Int]))

See this section of the scalatest manual: Logical Expressions

Daenyth
  • 35,856
  • 13
  • 85
  • 124