StringSpec test cases with multiline names broken
See original GitHub issueBugs
I think I have found two bugs with StringSpec
s. I’m unsure whether other testing styles are affected as well.
Environment
Here’s my environment. I’m unsure whether other environments are affected.
- Kotlin/JVM 1.3.72
- Kotest 4.0.5
- Gradle 6.4
Bug 1: Test Failures
Consider this psuedocode.
class TestSuite : StringSpec({
"""
test
case
1
""" {
// test
}
"""
test
case
2
""" {
// test
}
"test case 3" {
// test
}
})
If I run the entire suite, and the first two test cases fail, then the error message used for one of the cases is used as the error message for the other case as well. Similarly, if only one of the first two cases fail, both fail with the error message of the failed case.
I guess this happens even if there’s more than one test case with a multiline name.
Bug 2: Focusing
Focusing (prepending the test case’s name with f:
) doesn’t work for test cases with multiline names. In essence, every test case runs even if I focus a test case with a multiline name.
I guess the same holds true for bangs (prepending the test case’s name with !
).
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (5 by maintainers)
Fix will be included in 4.0.6 and 4.1.0
This is a gradle limitation whereby it’s taking only the first line from the multi line, which is of course just a ‘\n’ in this case, so they clash. We should strip out new lines from multiline strings, as they won’t work in intellij or gradle. We already strip newlines in the intellij plugin.
On Sat, 16 May 2020 at 20:38, Neel Kamath notifications@github.com wrote: