Unverified Commit 1ac09088 authored by kwkr's avatar kwkr Committed by GitHub

Fix/use contains ignoring whitespace (#55887)

parent 9d7af39a
......@@ -648,7 +648,7 @@ void main() {
createTestCommandRunner(command).run(<String>['attach']),
throwsToolExit(),
);
expect(testLogger.statusText, contains('No supported devices connected'));
expect(testLogger.statusText, containsIgnoringWhitespace('No supported devices connected'));
}, overrides: <Type, Generator>{
FileSystem: () => testFileSystem,
ProcessManager: () => FakeProcessManager.any(),
......@@ -671,7 +671,7 @@ void main() {
createTestCommandRunner(command).run(<String>['attach']),
throwsToolExit(),
);
expect(testLogger.statusText, contains('More than one device'));
expect(testLogger.statusText, containsIgnoringWhitespace('More than one device'));
expect(testLogger.statusText, contains('xx1'));
expect(testLogger.statusText, contains('yy2'));
}, overrides: <Type, Generator>{
......
......@@ -161,7 +161,10 @@ void main() {
'--enable-web'
]);
expect(testLogger.statusText, contains('You may need to restart any open editors'));
expect(
testLogger.statusText,
containsIgnoringWhitespace('You may need to restart any open editors'),
);
}, overrides: <Type, Generator>{
Usage: () => mockUsage,
});
......@@ -183,10 +186,22 @@ void main() {
'config',
]);
expect(testLogger.statusText, contains('enable-web: true (Unavailable)'));
expect(testLogger.statusText, contains('enable-linux-desktop: true (Unavailable)'));
expect(testLogger.statusText, contains('enable-windows-desktop: true (Unavailable)'));
expect(testLogger.statusText, contains('enable-macos-desktop: true (Unavailable)'));
expect(
testLogger.statusText,
containsIgnoringWhitespace('enable-web: true (Unavailable)'),
);
expect(
testLogger.statusText,
containsIgnoringWhitespace('enable-linux-desktop: true (Unavailable)'),
);
expect(
testLogger.statusText,
containsIgnoringWhitespace('enable-windows-desktop: true (Unavailable)'),
);
expect(
testLogger.statusText,
containsIgnoringWhitespace('enable-macos-desktop: true (Unavailable)'),
);
verifyNoAnalytics();
}, overrides: <Type, Generator>{
AndroidStudio: () => mockAndroidStudio,
......
......@@ -31,7 +31,7 @@ void main() {
testUsingContext('no error when no connected devices', () async {
final DevicesCommand command = DevicesCommand();
await createTestCommandRunner(command).run(<String>['devices']);
expect(testLogger.statusText, contains('No devices detected'));
expect(testLogger.statusText, containsIgnoringWhitespace('No devices detected'));
}, overrides: <Type, Generator>{
AndroidSdk: () => null,
DeviceManager: () => DeviceManager(),
......
......@@ -113,9 +113,10 @@ void main() {
expect(e, isA<ToolExit>());
}
final BufferLogger bufferLogger = globals.logger as BufferLogger;
expect(bufferLogger.statusText, contains(
'Changing current working directory to:'
));
expect(
bufferLogger.statusText,
containsIgnoringWhitespace('Changing current working directory to:'),
);
}, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(),
ProcessManager: () => FakeProcessManager.any(),
......@@ -230,7 +231,10 @@ void main() {
expect(e.message, null);
}
expect(testLogger.statusText, contains(userMessages.flutterNoSupportedDevices));
expect(
testLogger.statusText,
containsIgnoringWhitespace(userMessages.flutterNoSupportedDevices),
);
}, overrides: <Type, Generator>{
DeviceManager: () => mockDeviceManager,
FileSystem: () => fs,
......
......@@ -35,7 +35,10 @@ void main() {
// The bots may return an empty list of channels (network hiccup?)
// and when run locally the list of branches might be different
// so we check for the header text rather than any specific channel name.
expect(testLogger.statusText, contains('Flutter channels:'));
expect(
testLogger.statusText,
containsIgnoringWhitespace('Flutter channels:'),
);
}
testUsingContext('list', () async {
......@@ -212,7 +215,10 @@ void main() {
environment: anyNamed('environment'),
)).called(1);
expect(testLogger.statusText, contains("Switching to flutter channel 'beta'..."));
expect(
testLogger.statusText,
containsIgnoringWhitespace("Switching to flutter channel 'beta'..."),
);
expect(testLogger.errorText, hasLength(0));
when(mockProcessManager.start(
......@@ -290,12 +296,16 @@ void main() {
environment: anyNamed('environment'),
)).called(1);
expect(testLogger.statusText, containsIgnoringWhitespace(
"Successfully switched to flutter channel 'beta'."));
expect(testLogger.statusText,
expect(
testLogger.statusText,
containsIgnoringWhitespace("Successfully switched to flutter channel 'beta'."),
);
expect(
testLogger.statusText,
containsIgnoringWhitespace(
"To ensure that you're on the latest build "
"from this channel, run 'flutter upgrade'"));
"from this channel, run 'flutter upgrade'"),
);
expect(testLogger.errorText, hasLength(0));
}, overrides: <Type, Generator>{
FileSystem: () => MemoryFileSystem(),
......
......@@ -375,12 +375,18 @@ void main() {
);
}, throwsToolExit(message: 'Gradle task assembleRelease failed with exit code 1'));
expect(testLogger.statusText,
contains('The shrinker may have failed to optimize the Java bytecode.'));
expect(testLogger.statusText,
contains('To disable the shrinker, pass the `--no-shrink` flag to this command.'));
expect(testLogger.statusText,
contains('To learn more, see: https://developer.android.com/studio/build/shrink-code'));
expect(
testLogger.statusText,
containsIgnoringWhitespace('The shrinker may have failed to optimize the Java bytecode.'),
);
expect(
testLogger.statusText,
containsIgnoringWhitespace('To disable the shrinker, pass the `--no-shrink` flag to this command.'),
);
expect(
testLogger.statusText,
containsIgnoringWhitespace('To learn more, see: https://developer.android.com/studio/build/shrink-code'),
);
verify(mockUsage.sendEvent(
'build',
......@@ -433,11 +439,16 @@ void main() {
);
}, throwsToolExit());
expect(testLogger.statusText, containsIgnoringWhitespace("Your app isn't using AndroidX"));
expect(testLogger.statusText, containsIgnoringWhitespace(
expect(
testLogger.statusText,
containsIgnoringWhitespace("Your app isn't using AndroidX"),
);
expect(
testLogger.statusText,
containsIgnoringWhitespace(
'To avoid potential build failures, you can quickly migrate your app by '
'following the steps on https://goo.gl/CP92wY'
)
),
);
verify(mockUsage.sendEvent(
'build',
......
......@@ -303,12 +303,18 @@ void main() {
);
}, throwsToolExit(message: 'Gradle task bundleRelease failed with exit code 1'));
expect(testLogger.statusText,
contains('The shrinker may have failed to optimize the Java bytecode.'));
expect(testLogger.statusText,
contains('To disable the shrinker, pass the `--no-shrink` flag to this command.'));
expect(testLogger.statusText,
contains('To learn more, see: https://developer.android.com/studio/build/shrink-code'));
expect(
testLogger.statusText,
containsIgnoringWhitespace('The shrinker may have failed to optimize the Java bytecode.'),
);
expect(
testLogger.statusText,
containsIgnoringWhitespace('To disable the shrinker, pass the `--no-shrink` flag to this command.'),
);
expect(
testLogger.statusText,
containsIgnoringWhitespace('To learn more, see: https://developer.android.com/studio/build/shrink-code'),
);
verify(mockUsage.sendEvent(
'build',
......@@ -361,11 +367,16 @@ void main() {
);
}, throwsToolExit());
expect(testLogger.statusText, containsIgnoringWhitespace("Your app isn't using AndroidX"));
expect(testLogger.statusText, containsIgnoringWhitespace(
expect(
testLogger.statusText,
containsIgnoringWhitespace("Your app isn't using AndroidX"),
);
expect(
testLogger.statusText,
containsIgnoringWhitespace(
'To avoid potential build failures, you can quickly migrate your app by '
'following the steps on https://goo.gl/CP92wY'
)
),
);
verify(mockUsage.sendEvent(
'build',
......@@ -412,12 +423,17 @@ void main() {
);
}, throwsToolExit());
expect(testLogger.statusText,
not(containsIgnoringWhitespace("Your app isn't using AndroidX")));
expect(
testLogger.statusText, not(containsIgnoringWhitespace(
'To avoid potential build failures, you can quickly migrate your app by '
'following the steps on https://goo.gl/CP92wY'))
testLogger.statusText,
not(containsIgnoringWhitespace("Your app isn't using AndroidX")),
);
expect(
testLogger.statusText,
not(
containsIgnoringWhitespace(
'To avoid potential build failures, you can quickly migrate your app by '
'following the steps on https://goo.gl/CP92wY'),
)
);
verify(mockUsage.sendEvent(
'build',
......
......@@ -103,7 +103,10 @@ void main() {
await completer.future;
final String errorText = testLogger.errorText;
expect(errorText, contains('Oops; flutter has exited unexpectedly: "an exception % --".\n'));
expect(
errorText,
containsIgnoringWhitespace('Oops; flutter has exited unexpectedly: "an exception % --".\n'),
);
final File log = globals.fs.file('/flutter_01.log');
final String logContents = log.readAsStringSync();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment