Skip to content

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

Closed

Description

@jeff9315

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".

Activity

  1. DanTup commented on Aug 30, 2022

    @DanTup
    Member

    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.

  2. 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[/+] on Aug 30, 2022
  3. added
    in testingRelates to test execution of Dart/Flutter tests for end users
    on Aug 30, 2022
  4. added this to the v3.48.0 milestone on Aug 30, 2022
  5. 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[/+] on Aug 30, 2022
  6. DanTup commented on Aug 30, 2022

    @DanTup
    Member

    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 :-)

  7. jeff9315 commented on Aug 30, 2022

    @jeff9315
    Author

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

    Thanks for the quick fix.

  8. added a commit that references this issue on Sep 2, 2025
    ccd43d9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    in testingRelates to test execution of Dart/Flutter tests for end usersis bug

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions