1
如何it should
接受一個字符串,然後函數沒有括號:爲什麼它應該使用「」{}類型檢查scalatest?
import org.scalatest.FlatSpec
import scala.collection.mutable.Stack
class StackSpec extends FlatSpec {
it should "pop values in last-in-first-out order" in {
}
}
爲什麼豈不是:
it(should("pop values in last-in-first-out order" in {
}))
最近我才允許類似的編譯是:
object st {
class fs {
def it(f: => Unit) = {
}
def should(s: String)(f: => Unit): Unit = {
Unit
}
it(should("pop values in last-in-first-out order") {
})
}
}