Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我试过
assert(anOption)(contains("x"))
但这仅适用于 List 或 Seq 等 Iterables。
assert(anOption)(isSome(equalTo("x")))
也可能是assert(anOption)(equalTo(Some("x")))- 只是使用平等。或者,如果您想使用 contains:assert(isTrue(anOption.contains("x"))) 在选项上使用 contains 运算符
assert(anOption)(equalTo(Some("x")))
assert(isTrue(anOption.contains("x")))