Skip to content

Commit

Permalink
Dartdev bug fix, this fixes dart-lang#43238
Browse files Browse the repository at this point in the history
Bug: dart-lang#43238
Change-Id: I166b8c24b7ba708d619fd33415c18220eae6dc58
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/160882
Auto-Submit: Jaime Wren <jwren@google.com>
Commit-Queue: Jaime Wren <jwren@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
  • Loading branch information
jwren authored and commit-bot@chromium.org committed Aug 28, 2020
1 parent 434855f commit 2ca30d8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/dartdev/lib/src/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ class PubUtils {
allCmds != null &&
args.isNotEmpty &&
allCmds.isNotEmpty &&
args.firstWhere((arg) => allCmds.contains(arg)) == 'help' &&
args.firstWhere((arg) => allCmds.contains(arg), orElse: () => '') ==
'help' &&
args.contains('help') &&
args.contains('pub') &&
args.indexOf('help') + 1 == args.indexOf('pub');
Expand Down
2 changes: 2 additions & 0 deletions pkg/dartdev/test/utils_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ void main() {
expect(PubUtils.shouldModifyArgs([], null), isFalse);
expect(PubUtils.shouldModifyArgs(null, []), isFalse);
expect(PubUtils.shouldModifyArgs([], []), isFalse);
expect(PubUtils.shouldModifyArgs(['-h'], allCmds), isFalse);
expect(PubUtils.shouldModifyArgs(['--help'], allCmds), isFalse);
expect(PubUtils.shouldModifyArgs(['help'], allCmds), isFalse);
expect(PubUtils.shouldModifyArgs(['pub'], allCmds), isFalse);
expect(PubUtils.shouldModifyArgs(['analyze', 'help', 'pub'], allCmds),
Expand Down

0 comments on commit 2ca30d8

Please sign in to comment.