Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@DanTup
Copy link
Contributor

@DanTup DanTup commented Feb 1, 2023

This allows tests to be filtered by name/line/col using a URI format passed to flutter test, as dart test now does (dart-lang/test#1604).

flutter test test/foo_test.dart
flutter test "test/foo_test.dart?full-name=bar"
flutter test "test/foo_test.dart?line=15"

Mostly it's just changing some Strings to URIs, which are then passed on to package:test.

The motivation here is to be able to run tests by the line they appear on from IDE UIs, because currently they have to use --name which doesn't handle overlapping or dynamic names very well (or test names with characters that are complicated to escape when using shell-execute).

Fixes #114968.

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@flutter-dashboard flutter-dashboard bot added c: contributor-productivity Team-specific productivity, code health, technical debt. tool Affects the "flutter" command-line tool. See also t: labels. labels Feb 1, 2023
@DanTup DanTup force-pushed the support-test-lines branch from 8f6cc86 to 32c77d3 Compare February 16, 2023 12:36
@DanTup DanTup marked this pull request as ready for review February 18, 2023 10:08
}
_testFiles = _findTests(testDir).toList();
if (_testFiles.isEmpty) {
_testFileUris..clear()..addAll(_findTests(testDir).map(Uri.file));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we have to clear _testFileUris?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't. I guess I did this to preserve the original semantics (the original _testFiles was overwritten). Unless this verifyThenRunCommand method is being called multiple times on a single instance, it shouldn't make a difference.

(I've removed it now).

Copy link
Contributor

@christopherfujino christopherfujino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@DanTup DanTup merged commit 06952ba into flutter:master Feb 27, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 27, 2023
@DanTup DanTup deleted the support-test-lines branch March 1, 2023 10:51
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 10, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c: contributor-productivity Team-specific productivity, code health, technical debt. tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support running multiple tests by line/col (as package:test does)

2 participants