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

Tests with more than one newlines in names are not runnable from CodeLens links #4125

Closed
jeff9315 opened this issue Aug 29, 2022 · 3 comments
Labels
in testing Relates to test execution of Dart/Flutter tests for end users is bug
Milestone

Comments

@jeff9315
Copy link

jeff9315 commented Aug 29, 2022

No tests match regular expression " test & exit /B 0". #4007
#4007

This fails in Windows 11 using Dart Code 3.46.1

 test('''
    Given formType is signIn
    When signInWithEmailAndPassword succeeds
    Then return true
    And state is AsyncData
    ''', () async {

This succeeds

test('''
    Given formType is signIn When signInWithEmailAndPassword succeeds Then return true And state is AsyncData
    ''', () async {

The error is

No tests match regular expression "submit Given formType is signIn\n When signInWithEmailAndPassword succeeds & exit /B 0".

@DanTup
Copy link
Member

DanTup commented Aug 30, 2022

Thanks. I think there's something slightly different going on here, as if I use the original case from that issue things still work, but the case above does not:

  // This one fails
  test('''
    Given formType is signIn
    When signInWithEmailAndPassword succeeds
    Then return true
    And state is AsyncData
    ''', () async {});
  // This one works
  testWidgets('''
        test
        ''', (tester) async {});

So let's keep this issue open and use it for this rather than re-open that one.

@DanTup DanTup changed the title I just wanted to make sure this issue gets reopened ... #4007 Some tests with multiline names are not runnable from CodeLens links Aug 30, 2022
@DanTup DanTup added the in testing Relates to test execution of Dart/Flutter tests for end users label Aug 30, 2022
@DanTup DanTup added this to the v3.48.0 milestone Aug 30, 2022
@DanTup DanTup changed the title Some tests with multiline names are not runnable from CodeLens links Tests with more than one newlines in names are not runnable from CodeLens links Aug 30, 2022
@DanTup DanTup closed this as completed in ccd43d9 Aug 30, 2022
@DanTup
Copy link
Member

DanTup commented Aug 30, 2022

This turned out to be the same issue but when there was more than one newline. It was a bad regex escape that only replaced the first:

.replace("\n", "\\n") // bad
.replace(/\n/g, "\\n") // good

Not the first time I've had a bug like that, perhaps I need a lint :-)

@jeff9315
Copy link
Author

jeff9315 commented Aug 30, 2022

Ironic that this bug was in the testing module :-)

Thanks for the quick fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in testing Relates to test execution of Dart/Flutter tests for end users is bug
Projects
None yet
Development

No branches or pull requests

2 participants