aboutsummaryrefslogtreecommitdiff
path: root/examples/build-scalatest/src/test/scala/Test.scala
diff options
context:
space:
mode:
authorKatrin Shechtman <katrin.shechtman@gmail.com>2016-05-26 22:03:43 -0600
committerKatrin Shechtman <katrin.shechtman@gmail.com>2016-05-26 23:29:10 -0600
commit4d2971feca87833f48290c15e2331141bcd21351 (patch)
treece41b1f9583cdd4262221e583ab9598f1b9fb9f7 /examples/build-scalatest/src/test/scala/Test.scala
parentba203490c976adaa8001c4398e2c5e3befcc8757 (diff)
downloadcbt-4d2971feca87833f48290c15e2331141bcd21351.tar.gz
cbt-4d2971feca87833f48290c15e2331141bcd21351.tar.bz2
cbt-4d2971feca87833f48290c15e2331141bcd21351.zip
Making scalatest plugin work + example build folder with scalatest sample build
Diffstat (limited to 'examples/build-scalatest/src/test/scala/Test.scala')
-rw-r--r--examples/build-scalatest/src/test/scala/Test.scala24
1 files changed, 24 insertions, 0 deletions
diff --git a/examples/build-scalatest/src/test/scala/Test.scala b/examples/build-scalatest/src/test/scala/Test.scala
new file mode 100644
index 0000000..d176080
--- /dev/null
+++ b/examples/build-scalatest/src/test/scala/Test.scala
@@ -0,0 +1,24 @@
+import collection.mutable.Stack
+import org.scalatest._
+
+class Test 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()
+ }
+ }
+
+ "square" should "return double" in {
+ Main.square(2) should be (4)
+ }
+} \ No newline at end of file