【发布时间】:2018-05-26 02:26:46
【问题描述】:
我正在使用 scalatest FlatSpec 库来测试我的代码。 下面是我为了测试我的代码而编写的函数:
def compareToHello (a:String) = {
a match {case "Hello" => println ("Hello")
case _ => println("error")}
}
对于测试部分:
import org.scalatest.{ FlatSpec, GivenWhenThen, Matchers }
class AestA extends FlatSpec with GivenWhenThen with Matchers {
"Implemented function" should "compare input string to hello"in {
val test=compareToHello("Hello)
assert
}
}
当我的函数的输出显示在控制台中时,我遇到了关于在断言中放入什么内容的问题。 我正在学习 scala ,这就是我问这种问题的原因 非常感谢
【问题讨论】:
标签: scalatest