下面的注释行打破了我的测试
import org.scalatest.WordSpec
class LSESuite extends WordSpec {
"An LSE market" should {
"round values" in {
val lse = new LSE {
}
assert(lse.getMarketName === "LSE")
//"min tick size" is (pending)
}
}
}
我收到以下错误“它的子句可能不会出现在另一个子句中”,但我不确定如何解释。编辑堆栈跟踪:
org.scalatest.TestRegistrationClosedException: An it clause may not appear inside another it clause.
at org.scalatest.SuperEngine.registerTest(Engine.scala:406)
at org.scalatest.WordSpec$class.org$scalatest$WordSpec$$registerTestToRun(WordSpec.scala:1643)
at org.scalatest.WordSpec$WordSpecStringWrapper.is(WordSpec.scala:1823)
at org.scalatest.WordSpec$$anonfun$runTests$1.apply(WordSpec.scala:2232)
at org.scalatest.WordSpec$$anonfun$runTests$1.apply(WordSpec.scala:2232)
at org.scalatest.SuperEngine$$anonfun$org$scalatest$SuperEngine$$runTestsInBranch$1.apply(Engine.scala:226)
at org.scalatest.SuperEngine$$anonfun$org$scalatest$SuperEngine$$runTestsInBranch$1.apply(Engine.scala:215)
at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
at scala.collection.immutable.List.foreach(List.scala:45)
at org.scalatest.SuperEngine.org$scalatest$SuperEngine$$runTestsInBranch(Engine.scala:215)
at org.scalatest.SuperEngine$$anonfun$org$scalatest$SuperEngine$$runTestsInBranch$1.apply(Engine.scala:231)
at org.scalatest.SuperEngine$$anonfun$org$scalatest$SuperEngine$$runTestsInBranch$1.apply(Engine.scala:215)
at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
at scala.collection.immutable.List.foreach(List.scala:45)
at org.scalatest.SuperEngine.org$scalatest$SuperEngine$$runTestsInBranch(Engine.scala:215)
at org.scalatest.SuperEngine.runTestsImpl(Engine.scala:282)
at org.scalatest.WordSpec$class.runTests(WordSpec.scala:2232)
at org.scalatest.Suite$class.run(Suite.scala:2286)
at org.scalatest.WordSpec$$anonfun$run$1.apply(WordSpec.scala:2279)
at org.scalatest.WordSpec$$anonfun$run$1.apply(WordSpec.scala:2279)
at org.scalatest.SuperEngine.runImpl(Engine.scala:318)
at org.scalatest.WordSpec$class.run(WordSpec.scala:2279)
at org.scalatest.tools.SuiteRunner.run(SuiteRunner.scala:59)
at org.scalatest.tools.Runner$$anonfun$doRunRunRunDaDoRunRun$3.apply(Runner.scala:1517)
at org.scalatest.tools.Runner$$anonfun$doRunRunRunDaDoRunRun$3.apply(Runner.scala:1514)
at scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
at scala.collection.immutable.List.foreach(List.scala:45)
at org.scalatest.tools.Runner$.doRunRunRunDaDoRunRun(Runner.scala:1514)
at org.scalatest.tools.Runner$$anonfun$runOptionallyWithPassFailReporter$2.apply(Runner.scala:584)
at org.scalatest.tools.Runner$$anonfun$runOptionallyWithPassFailReporter$2.apply(Runner.scala:583)
at org.scalatest.tools.Runner$.withClassLoaderAndDispatchReporter(Runner.scala:1558)
at org.scalatest.tools.Runner$.runOptionallyWithPassFailReporter(Runner.scala:582)
at org.scalatest.tools.Runner$.run(Runner.scala:485)
at org.scalatest.tools.Runner.run(Runner.scala)
at org.jetbrains.plugins.scala.testingSupport.scalaTest.ScalaTest15Scala28Runner.main(ScalaTest15Scala28Runner.java:34)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Process finished with exit code 0
答案 0 :(得分:0)
您的“待定”似乎位于奇怪的位置。所以你可能会看到我在这里看到的同样的问题:http://groups.google.com/group/scalatest-users/browse_thread/thread/177bbc520edc8fbd