spockframework / spockframework/spock
Strange error reporting when inlining """blabla""".stripIndent() inside 'when' block
Open
Nobody has claimed this yet.
Module-Core
Type-Defect
- Dominant language
- Java
- Stars
- 3.6k
- Forks
- 483
- PR merge metrics
- No merged PRs in 30d
Description
Originally reported on Google Code with ID 214
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.
Reported by steinar.haugen on 2011-11-04 17:36:59
- _Attachment: [ErrorReportingUsingStripIndentInThenBlockSpecification.groovy](https://storage.googleapis.com/google-code-attachments/spock/issue-214/comment-0/ErrorReportingUsingStripIndentInThenBlockSpecification.groovy)_
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the attached ErrorReportingUsingStripIndentInThenBlockSpecification.groovy and compare its two similar methods and the error reports in the issue comments. Reproduce the failing test with the reported Groovy and Spock versions, then verify that the stripIndent() case produces an error report as clear as the comparable case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- groovy
- Domain
- testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100