Muki-SkyWalker / specs

Automatically exported from code.google.com/p/specs
Other
0 stars 0 forks source link

Weird stacktrace #99

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
scala specs 1.6.1 on mac os x
unpack specscase.tgz, run "mvn test"

ExampleTest.txt in target/surefire-reports/ should contain some stacktrace 
originated in 
ExampleTest.scala, but here is what I get instead:

--------------------------------------------------------------------------
-----
Test set: ExampleTest
--------------------------------------------------------------------------
-----
Tests run: 2, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.023 sec <<< 
FAILURE!
example should show proper stack trace  Time elapsed: 0.004 sec  <<< ERROR!
org.specs.runner.UserError: ExampleException$: null
        at ExampleException$.<clinit>(Example.scala)
        at 
Example2Test$$anonfun$1$$anonfun$apply$4$$anonfun$apply$6.apply(Example2Test.sca
la:12
)
        at 
Example2Test$$anonfun$1$$anonfun$apply$4$$anonfun$apply$6.apply(Example2Test.sca
la:12
)

It's quite hard to find out what really happened using this stacktrace.

Original issue reported on code.google.com by victorbi...@gmail.com on 26 Nov 2009 at 10:09

Attachments:

GoogleCodeExporter commented 9 years ago
Hi,

Really, really weird indeed. If I rename Example2 to Example3, then I get a 
correct 
stacktrace?

What other kind of experiments did you try on this issue? How frequently do you 
see 
that case coming up?

The other thing I did was run the example class using the console runner and it 
was 
fine. That may be a surefire issue?

Original comment by etorrebo...@gmail.com on 27 Nov 2009 at 2:19

GoogleCodeExporter commented 9 years ago
I made few more tests to find out where the bug exactly is and it turns out 
that it is not a specs or surefire issue. 
So opening this issue here was a bit premature. I can reproduce this with JUnit 
alone, so I guess this issue 
should be closed as invalid, and I should find the bug and submit the patch to 
JUnit team.

Original comment by victorbi...@gmail.com on 27 Nov 2009 at 6:14

GoogleCodeExporter commented 9 years ago
> it turns out that it is not a specs or surefire issue

That's good the know, thanks.

Original comment by etorrebo...@gmail.com on 27 Nov 2009 at 6:56

GoogleCodeExporter commented 9 years ago
It was me, finally. The idea of throwing scala objects is indeed screwed - 
first time you throw it you fill the 
stacktrace, basically, so when you're throwing it again - it is thrown with the 
same old stacktrace. Sorry for 
bothering you. I've just blindly followed scalac suggestion to replace case 
classes without arguments (I just didn't 
need one) with objects(singletones).

Original comment by victorbi...@gmail.com on 27 Nov 2009 at 8:28

GoogleCodeExporter commented 9 years ago
Interesting. I had a quick look at that and thought "how strange". That's a 
nice 
example of side-effect. That may be a good case of "Scala puzzler" for the 
future!

Original comment by etorrebo...@gmail.com on 27 Nov 2009 at 11:51