Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Normalize multiline string spec test names. #252

Merged

Conversation

canatella
Copy link
Contributor

Currently, when defining a test in a StringSpec with multiple lines, it cannot be run by clicking the icon next to it. For example:

class MyTests : StringSpec({

    """This test name is spread
        over multiple lines withe indentation.
    """ {
        true shouldBe true
    }
})

The output when hitting the run single test icon:

... io.kotest.engine.launcher.MainKt --spec MyTests --testpath This test name is spread
        over multiple lines withe indentation.
     --reporter teamcity
Testing started at 10:51 ...

Process finished with exit code 0

This test name is spread over multiple lines withe indentation. is excluded by test filter(s): Excluded by test path filter: 'This test name is spread
        over multiple lines withe indentation.
    '

Replacing all consecutive white space in the name by a single space fixes the issue.

... io.kotest.engine.launcher.MainKt --spec com.bloomlife.lib.athena.MyTests --testpath This test name is spread over multiple lines withe indentation. --reporter teamcity
Testing started at 10:54 ...

Process finished with exit code 0

@Kantis
Copy link
Member

Kantis commented May 14, 2023

I believe this would solve #255 as well.. need to verify it.

@stale
Copy link

stale bot commented Aug 12, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Aug 12, 2023
@canatella
Copy link
Contributor Author

Any news ?

@stale stale bot closed this Sep 17, 2023
@canatella
Copy link
Contributor Author

That's not really nice. I take the time to submit a PR that fixes an issue. Nobody reacts, which I can understand, we are all busy, but then it's closed automatically. Come on...

@sksamuel sksamuel reopened this Sep 17, 2023
@sksamuel
Copy link
Member

Just the stale bot. Reopened.

@sksamuel
Copy link
Member

@canatella if you build this locally and install it, can you confirm you can then run multi-line tests from intellij?

I think we need to check as well that if you have a test with double spaces deliberately, it still works, because you're matching on \s+ rather than \n say.

@sksamuel sksamuel added pinned and removed wontfix This will not be worked on labels Sep 17, 2023
@canatella canatella force-pushed the fix-running-multiline-string-spec-test branch from 842d8b7 to 0f061cc Compare October 11, 2023 07:25
@canatella
Copy link
Contributor Author

@sksamuel I'm trying to add a unit test, but it seems I can't run them. What is the proper way to run the tests ? I'm using

PRODUCT_NAME=IC-233 ./gradlew check -Dorg.gradle.configureondemand=true -Dorg.gradle.parallel=false -Dkotlin.incremental=false -Dorg.gradle.jvmargs="-Xmx3g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8" 

But I have

java.lang.RuntimeException: java.util.concurrent.ExecutionException: com.intellij.testFramework.TestLoggerFactory$TestLoggerAssertionError: Index data initialization failed

@sksamuel
Copy link
Member

That seems to be an issue with any of the 23x builds. I test locally against 22x.

@sksamuel sksamuel merged commit f0e87aa into kotest:master Nov 20, 2023
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants