我需要检查一个字符串是否包含许多子字符串。以下作品
string should include ("seven")
string should include ("eight")
string should include ("nine")
但它需要三行几乎重复的行。我正在寻找类似的东西
string should contain allOf ("seven", "eight", "nine")
但是,这行不通...当字符串肯定包含这些子字符串时,断言只会失败。
如何在一行中执行这样的声明?
最佳答案
试试这个:
string should (include("seven") and include("eight") and include("nine"))
关于string - 字符串在ScalaTest Matchers中包含许多子字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37875725/