diff options
author | Jan Christopher Vogt <oss.nsp@cvogt.org> | 2016-06-19 16:31:47 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-06-19 16:31:47 -0400 |
commit | bb856040475cc15fe0754a52428375bd36f8b782 (patch) | |
tree | 3fe563f8596b49a136e12dfd693f7b21c0afc90d /examples/scalatest-example/src/test/scala/Test.scala | |
parent | 9596983505f1e0d2e4c582e1c23f04e35b42fde1 (diff) | |
parent | 32691b7908150970344a5c3a5c58fef9dec0a6ac (diff) | |
download | cbt-bb856040475cc15fe0754a52428375bd36f8b782.tar.gz cbt-bb856040475cc15fe0754a52428375bd36f8b782.tar.bz2 cbt-bb856040475cc15fe0754a52428375bd36f8b782.zip |
Merge pull request #150 from cvogt/chris2
various changes
Diffstat (limited to 'examples/scalatest-example/src/test/scala/Test.scala')
-rw-r--r-- | examples/scalatest-example/src/test/scala/Test.scala | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/examples/scalatest-example/src/test/scala/Test.scala b/examples/scalatest-example/src/test/scala/Test.scala new file mode 100644 index 0000000..48b0a36 --- /dev/null +++ b/examples/scalatest-example/src/test/scala/Test.scala @@ -0,0 +1,23 @@ +import collection.mutable.Stack +import org.scalatest._ + +class Test extends FlatSpec with Matchers { + "square" should "return double" in { + Main.square(2) should be (4) + } + + "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() + } + } +}
\ No newline at end of file |