2011-09-13 56 views
1

下面的註釋行打破了我的測試爲什麼添加一個「掛起」打破了我的Scala測試?

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

只是檢查你是否從代碼中刪除了評論? – deltanovember

+0

你如何運行測試? –

回答

相關問題