Adjust tools tests that would be broken by formatting (#160393)

These tests depend on line numbers that `dart format` is changing.
Pre-format the files in question and adjust the tests so they continue
to pass when the entire repo is formatted.
This commit is contained in:
Michael Goderbauer 2024-12-16 16:34:00 -08:00 committed by GitHub
parent e19e117c37
commit 79506323b9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 12 additions and 5 deletions

View File

@ -46,7 +46,7 @@ The following message was thrown running a test:
Who lives, who dies, who tells your story\? Who lives, who dies, who tells your story\?
When the exception was thrown, this was the stack: When the exception was thrown, this was the stack:
#[0-9]+ +main.<anonymous closure> \(.+[/\\]dev[/\\]automated_tests[/\\]flutter_test[/\\]exception_handling_test\.dart:16:5\) #[0-9]+ +main.<anonymous closure> \(.+[/\\]dev[/\\]automated_tests[/\\]flutter_test[/\\]exception_handling_test\.dart:18:5\)
<<skip until matching line>> <<skip until matching line>>
#[0-9]+ +.+ \(package:flutter_test[/\\]src[/\\]widget_tester\.dart:[0-9]+:[0-9]+\) #[0-9]+ +.+ \(package:flutter_test[/\\]src[/\\]widget_tester\.dart:[0-9]+:[0-9]+\)
<<skip until matching line>> <<skip until matching line>>

View File

@ -12,7 +12,9 @@ void main() {
testWidgets('Exception handling in test harness - FlutterError', (WidgetTester tester) async { testWidgets('Exception handling in test harness - FlutterError', (WidgetTester tester) async {
throw FlutterError('Who lives, who dies, who tells your story?'); throw FlutterError('Who lives, who dies, who tells your story?');
}); });
testWidgets('Exception handling in test harness - uncaught Future error', (WidgetTester tester) async { testWidgets('Exception handling in test harness - uncaught Future error', (
WidgetTester tester,
) async {
Future<void>.error('Who lives, who dies, who tells your story?'); Future<void>.error('Who lives, who dies, who tells your story?');
}); });
} }

View File

@ -32,7 +32,7 @@ The following message was thrown running a test:
Who lives, who dies, who tells your story\? Who lives, who dies, who tells your story\?
When the exception was thrown, this was the stack: When the exception was thrown, this was the stack:
#4 main.<anonymous closure> \(.+[/\\]dev[/\\]automated_tests[/\\]integration_test[/\\]exception_handling_test\.dart:16:5\) #4 main.<anonymous closure> \(.+[/\\]dev[/\\]automated_tests[/\\]integration_test[/\\]exception_handling_test\.dart:18:5\)
<<skip until matching line>> <<skip until matching line>>
The test description was: The test description was:
Exception handling in test harness - uncaught Future error Exception handling in test harness - uncaught Future error

View File

@ -12,7 +12,9 @@ void main() {
testWidgets('Exception handling in test harness - FlutterError', (WidgetTester tester) async { testWidgets('Exception handling in test harness - FlutterError', (WidgetTester tester) async {
throw FlutterError('Who lives, who dies, who tells your story?'); throw FlutterError('Who lives, who dies, who tells your story?');
}); });
testWidgets('Exception handling in test harness - uncaught Future error', (WidgetTester tester) async { testWidgets('Exception handling in test harness - uncaught Future error', (
WidgetTester tester,
) async {
Future<void>.error('Who lives, who dies, who tells your story?'); Future<void>.error('Who lives, who dies, who tells your story?');
}); });
} }

View File

@ -1830,8 +1830,10 @@ class DebugConnectionInfo {
/// Returns the next platform value for the switcher. /// Returns the next platform value for the switcher.
/// ///
/// These values must match what is available in /// These values must match what is available in
/// `packages/flutter/lib/src/foundation/binding.dart`. /// `packages/flutter/lib/src/foundation/platform.dart`.
String nextPlatform(String currentPlatform) { String nextPlatform(String currentPlatform) {
// The following lines are read by a script, which expects a certain format.
// dart format off
const List<String> platforms = <String>[ const List<String> platforms = <String>[
'android', 'android',
'iOS', 'iOS',
@ -1840,6 +1842,7 @@ String nextPlatform(String currentPlatform) {
'linux', 'linux',
'fuchsia', 'fuchsia',
]; ];
// dart format on
final int index = platforms.indexOf(currentPlatform); final int index = platforms.indexOf(currentPlatform);
assert(index >= 0, 'unknown platform "$currentPlatform"'); assert(index >= 0, 'unknown platform "$currentPlatform"');
return platforms[(index + 1) % platforms.length]; return platforms[(index + 1) % platforms.length];