Created
June 4, 2017 09:53
-
-
Save ddimtirov/f1635ec9a77b8145ce10e52bef4e6047 to your computer and use it in GitHub Desktop.
Spock bug: bad assertion message
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Condition not satisfied: | |
"""\ $a foobar covfefe """ == """ $b foobar covfefe """ | |
| | |
false |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Condition not satisfied: | |
x==y | |
|| | | |
|| 2 foobar | |
|| covfefe | |
|| | |
|false | |
|1 difference (97% similarity) | |
| (1) foobar\n covfefe\n | |
| (2) foobar\n covfefe\n | |
1 foobar | |
covfefe | |
<Click to see difference> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import spock.lang.Specification | |
import spock.lang.Unroll | |
class MultilineStringSpec extends Specification { | |
@Unroll def "when/then - string literal outside 'then' #label"() { | |
when: | |
def x="""\ | |
$a foobar | |
covfefe | |
""" | |
def y=""" $b foobar | |
covfefe | |
""" | |
then: | |
x==y | |
where: | |
a | b | label | |
1 | 1 | "success" | |
1 | 2 | "failure" | |
} | |
@Unroll def "when/then - string literal inside 'then' #label"() { | |
when: 'we move the string literal tot he assertion block' | |
System.currentTimeMillis() | |
then: 'same as above, just inlined' | |
"""\ | |
$a foobar | |
covfefe | |
""" == """ $b foobar | |
covfefe | |
""" | |
where: | |
a | b | label | |
1 | 1 | "success" | |
1 | 2 | "failure" | |
} | |
@Unroll def "expect #label"() { | |
expect: | |
"""\ | |
$a foobar | |
covfefe | |
"""==""" $b foobar | |
covfefe | |
""" | |
where: | |
a | b | label | |
1 | 1 | "success" | |
1 | 2 | "failure" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment