【发布时间】:2011-09-11 12:57:36
【问题描述】:
我正在为 ScalaTest 开发客户可读的 DSL。现在我可以写了
feature("Admin Login") {
scenario("Correct username and password") {
given("user visits", classOf[AdminHomePage])
then(classOf[SignInPage], "is displayed")
但是这样读起来会好很多
feature("Admin Login") {
scenario("Correct username and password") {
given("user visits", the[AdminHomePage])
then(the[SignInPage], "is displayed")
有什么办法
def the[T] =
返回classOf[T] ?
【问题讨论】: