在ScalaTest中遇到错误

时间:2015-12-23 05:53:09

标签: scala scalatest

我正在尝试运行一个简单的ScalaTest应用程序来理解scala测试 我的代码是:

 package org.scalatest.examples.flatspec
 import org.scalatest.FlatSpec
 import collection.mutable.Stack
 import org.scalatest._
 class ExampleSpec extends FlatSpec with Matchers {
 "A Stack" should "pop values in last-in-first-out order" in {
  val stack = new Stack[Int]
stack.push(1)
stack.push(2)
stack.pop() should be (2)
stack.pop() should be (1)
}

it should "throw NoSuchElementException if an empty stack is popped" in {
val emptyStack = new Stack[Int]
a [NoSuchElementException] should be thrownBy {
  emptyStack.pop()
} 
}
}

我还下载了scalatest_2.11-2.2.4.jar。我正在使用命令

编译文件
 scalac -cp scalatest_2.11-2.2.4.jar ExampleSpec.scala

并面临以下错误

 error while loading package, class file needed by package is missing.
 reference value <init>$default$2 of object deprecated refers to nonexisting symbol.

0 个答案:

没有答案