|
Re: Chapter 14 Assertions and Unit Testing - How to setup?
|
Posted: May 26, 2012 11:28 PM
|
|
In my first reply, I ran step 4 with the following, which would pass the test.
-- snip -- test("elem result should have passed width") { val ele = elem('x', 2, 3) expect(2) { ele.width } } -- snip ---
This may have been confusing because my step 3 (I think it was) was run with "elem('x', 3, 3)" which fails the test.
Here's the output if run step 4 with with "elem('x', 3, 3)" to fail the test.
Remember, you have to recompile the ElementSuite class after making the change.
Then:
$ scala -classpath ../scalatest-0.9.5.jar org.scalatest.tools.Runner -p . -o -s ElementSuite Run starting. Expected test count is: 1 ElementSuite: - elem result should have passed width *** FAILED *** Expected 2, but got 3 (SpiralFunSuiteTest.scala:7) Run completed in 95 milliseconds. Total number of tests run: 1 Suites: completed 1, aborted 0 Tests: succeeded 0, failed 1, ignored 0, pending 0 *** 1 TEST FAILED *** -- Paul
|
|