thenirajpandey / spock

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

Strange error reporting when inlining """blabla""".stripIndent() inside 'when' block #214

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
When comparing a string value to another in a 'when' block, then the error 
report is rather cryptic if the right-hand side of the compare is a multi-line 
string with a method call to stripIndent(). This might be a broader issue, but 
that was the exact case I ran into.

Note that this is only an issue for error reporting on failing tests, i.e. if 
the values are equal, then the test pass. 

See attached file for details, it contains two similar methods, one showing the 
expected error report and the other showing the "unexpected" error report. The 
actual reports are given in the comments.

I'm using Spock version 0.6-groovy-1.8-SNAPSHOT and groovy version 1.8.0.

Original issue reported on code.google.com by steinar....@gmail.com on 4 Nov 2011 at 5:36

Attachments:

GoogleCodeExporter commented 8 years ago
Don't seem to be able to edit the issue. When saying "when" block, I meant 
"then" block. Sorry for the confusion. 

Original comment by steinar....@gmail.com on 4 Nov 2011 at 5:39

GoogleCodeExporter commented 8 years ago
It's a known limitation (power-assert output may not work for multi-line 
assertions), but we should at least have a fall-back.

Original comment by pnied...@gmail.com on 10 Nov 2011 at 4:56

GoogleCodeExporter commented 8 years ago
This looks similar to http://code.google.com/p/spock/issues/detail?id=131

Original comment by jdbeu...@gmail.com on 23 Jul 2013 at 3:37