Closed GoogleCodeExporter closed 9 years ago
Eric, this particular issue was problematic in that our mock expectations were
failing because things were run multiple times. We ended up rolling back to
1.6.5 and things were fine. Hopefully you can add our example to your
regression tests. Use mocks and check that things were only called once or
twice.
class Foo {
def bar(i: Int) = i
def baz(s: String) = s
}
val foo = mock[Foo]
foo.bar(1)
foo.baz("1")
got {
one(foo).bar(1)
one(foo).baz("1")
}
Original comment by ste...@gmail.com
on 20 Jan 2011 at 12:13
I still don't know what's causing this, but I have a small idea.
Based on that idea, you can try the following workaround:
class TestSpec extends Specification {
"A test specification" should {
"be able to support nested examples" in {
"as seen here" in {
this mustNot beNull
println("1")
}
"as seen here also" in {
"other tests" in {
this mustNot beNull
println("2")
}
"and some more" in {
println("3")
this mustNot beNull
}
}
// add one last "simple" (not nested) example here
"as seen here" in {
this mustNot beNull
println("4")
}
}
}
}
Original comment by etorrebo...@gmail.com
on 20 Jan 2011 at 4:10
Eric, we're not going to rewrite thousands of lines of tests. Instead, we're
staying on 1.6.5 until this is fixed.
I'll get you a regression test that fails in 1.6.6.
Thanks. :-)
Original comment by ste...@gmail.com
on 20 Jan 2011 at 6:04
>> Eric, we're not going to rewrite thousands of lines of tests
Yes indeed :-).
I think this issue is fixed now in the latest SNAPSHOT (1.6.8-SNAPSHOT).
For the following specification:
import org.specs._
class TestSpec extends Specification {
"A test specification" should {
doFirst(println("first"))
doLast(println("last"))
doBefore(println("before"))
doAfter(println("after"))
"be able to support nested examples" in {
"as seen here" in {
this mustNot beNull
println("1")
}
"as seen here also" in {
"other tests" in {
this mustNot beNull
println("2")
}
"and some more" in {
println("3")
this mustNot beNull
}
}
}
}
}
The output is:
first
before
1
after
before
2
after
before
3
after
last
Thanks for confirming the fix.
Original comment by etorrebo...@gmail.com
on 22 Jan 2011 at 6:00
Original issue reported on code.google.com by
dloftesn...@gmail.com
on 19 Jan 2011 at 11:20Attachments: