-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
Labels
toolAffects the "flutter" command-line tool. See also t: labels.Affects the "flutter" command-line tool. See also t: labels.
Description
FakeCommand allows the test author to make sure that a command is invoked with a particular workingDirectory, environment, and/or encoding. However, the expect calls have their parameters swapped.
For example, a test including this snippet:
processManager.addCommand(
const FakeCommand(
command: <String>[sdkManagerPath, '--licenses'],
exitCode: 1,
environment: <String, String>{
'JAVA_HOME': 'expected value'
},
stderr: 'crash',
),
);Can result in output looking like this:
00:01 +0 -1: uses JDK bundled with Android Studio when validating license acceptance [E]
Expected: {}
Actual: {'JAVA_HOME': 'expected value'}
Which: has different length and has extra map key 'JAVA_HOME'
Relevant code:
flutter/packages/flutter_tools/test/src/fake_process_manager.dart
Lines 105 to 122 in 38630b6
| void _matches( | |
| List<String> command, | |
| String? workingDirectory, | |
| Map<String, String>? environment, | |
| Encoding? encoding, | |
| ) { | |
| final List<dynamic> matchers = this.command.map((Pattern x) => x is String ? x : matches(x)).toList(); | |
| expect(command, matchers); | |
| if (this.workingDirectory != null) { | |
| expect(this.workingDirectory, workingDirectory); | |
| } | |
| if (this.environment != null) { | |
| expect(this.environment, environment); | |
| } | |
| if (this.encoding != null) { | |
| expect(this.encoding, encoding); | |
| } | |
| } |
Metadata
Metadata
Assignees
Labels
toolAffects the "flutter" command-line tool. See also t: labels.Affects the "flutter" command-line tool. See also t: labels.