enable lint prefer_interpolation_to_compose_strings (#83407)

This commit is contained in:
Alexandre Ardhuin
2021-06-01 20:14:06 +02:00
committed by GitHub
parent 71e711547f
commit 34059eec2c
96 changed files with 367 additions and 345 deletions

View File

@@ -660,7 +660,7 @@ void main() {
expectExists('android/gradle.properties');
final String actualContents = await globals.fs.file(projectDir.path + '/android/gradle.properties').readAsString();
final String actualContents = await globals.fs.file('${projectDir.path}/android/gradle.properties').readAsString();
expect(actualContents.contains('useAndroidX'), true);
});
@@ -694,7 +694,7 @@ void main() {
expectExists('android/gradle.properties');
final String actualContents = await globals.fs.file(projectDir.path + '/android/gradle.properties').readAsString();
final String actualContents = await globals.fs.file('${projectDir.path}/android/gradle.properties').readAsString();
expect(actualContents.contains('useAndroidX'), true);
});
@@ -708,13 +708,13 @@ void main() {
await runner.run(<String>['create', '--no-pub', '--platforms', 'android', projectDir.path]);
final String androidManifest = await globals.fs.file(
projectDir.path + '/android/app/src/main/AndroidManifest.xml'
'${projectDir.path}/android/app/src/main/AndroidManifest.xml'
).readAsString();
expect(androidManifest.contains('android:name="flutterEmbedding"'), true);
expect(androidManifest.contains('android:value="2"'), true);
final String mainActivity = await globals.fs.file(
projectDir.path + '/android/app/src/main/kotlin/com/example/flutter_project/MainActivity.kt'
'${projectDir.path}/android/app/src/main/kotlin/com/example/flutter_project/MainActivity.kt'
).readAsString();
// Import for the new embedding class.
expect(mainActivity.contains('import io.flutter.embedding.android.FlutterActivity'), true);
@@ -1090,7 +1090,7 @@ void main() {
expectExists('lib/main.dart');
expectExists('test/widget_test.dart');
final String actualContents = await globals.fs.file(projectDir.path + '/test/widget_test.dart').readAsString();
final String actualContents = await globals.fs.file('${projectDir.path}/test/widget_test.dart').readAsString();
expect(actualContents.contains('flutter_test.dart'), true);
@@ -2254,7 +2254,7 @@ void main() {
expect(globals.fs.isFileSync('${projectDir.path}/android/app/build.gradle'), true);
final String buildContent = await globals.fs.file(projectDir.path + '/android/app/build.gradle').readAsString();
final String buildContent = await globals.fs.file('${projectDir.path}/android/app/build.gradle').readAsString();
expect(buildContent.contains('compileSdkVersion 30'), true);
expect(buildContent.contains('targetSdkVersion 30'), true);
@@ -2587,7 +2587,7 @@ Future<void> _ensureFlutterToolsSnapshot() async {
final File snapshotFile = globals.fs.file(flutterToolsSnapshotPath);
if (snapshotFile.existsSync()) {
snapshotFile.renameSync(flutterToolsSnapshotPath + '.bak');
snapshotFile.renameSync('$flutterToolsSnapshotPath.bak');
}
final List<String> snapshotArgs = <String>[
@@ -2615,7 +2615,7 @@ Future<void> _restoreFlutterToolsSnapshot() async {
'flutter_tools.snapshot',
));
final File snapshotBackup = globals.fs.file(flutterToolsSnapshotPath + '.bak');
final File snapshotBackup = globals.fs.file('$flutterToolsSnapshotPath.bak');
if (!snapshotBackup.existsSync()) {
// No backup to restore.
return;

View File

@@ -162,7 +162,7 @@ void main() {
completer: Completer<void>.sync(),
// Example stack trace from an incorrectly named application:name in the AndroidManfiest.xml
stdout:
kDummyLine +
'$kDummyLine'
'05-11 12:54:46.665 E/AndroidRuntime(11787): FATAL EXCEPTION: main\n'
'05-11 12:54:46.665 E/AndroidRuntime(11787): Process: com.example.foobar, PID: 11787\n'
'05-11 12:54:46.665 java.lang.RuntimeException: Unable to instantiate application '

View File

@@ -114,7 +114,7 @@ void main() {
processManager.addCommand(
FakeCommand(
command: <String>[
artifacts.getArtifactPath(Artifact.genSnapshot, platform: TargetPlatform.ios, mode: BuildMode.release) + '_armv7',
'${artifacts.getArtifactPath(Artifact.genSnapshot, platform: TargetPlatform.ios, mode: BuildMode.release)}_armv7',
'--additional_arg'
],
),
@@ -129,10 +129,15 @@ void main() {
});
testWithoutContext('iOS arm64', () async {
final String genSnapshotPath = artifacts.getArtifactPath(
Artifact.genSnapshot,
platform: TargetPlatform.ios,
mode: BuildMode.release,
);
processManager.addCommand(
FakeCommand(
command: <String>[
artifacts.getArtifactPath(Artifact.genSnapshot, platform: TargetPlatform.ios, mode: BuildMode.release) + '_arm64',
'${genSnapshotPath}_arm64',
'--additional_arg',
],
),
@@ -238,11 +243,14 @@ void main() {
testWithoutContext('builds iOS with bitcode', () async {
final String outputPath = fileSystem.path.join('build', 'foo');
final String assembly = fileSystem.path.join(outputPath, 'snapshot_assembly.S');
final String genSnapshotPath = artifacts.getArtifactPath(
Artifact.genSnapshot,
platform: TargetPlatform.ios,
mode: BuildMode.profile,
);
processManager.addCommands(<FakeCommand>[
FakeCommand(command: <String>[
artifacts.getArtifactPath(Artifact.genSnapshot,
platform: TargetPlatform.ios, mode: BuildMode.profile) +
'_armv7',
'${genSnapshotPath}_armv7',
'--deterministic',
'--snapshot_kind=app-aot-assembly',
'--assembly=$assembly',
@@ -295,11 +303,14 @@ void main() {
final String outputPath = fileSystem.path.join('build', 'foo');
final String assembly = fileSystem.path.join(outputPath, 'snapshot_assembly.S');
final String debugPath = fileSystem.path.join('foo', 'app.ios-armv7.symbols');
final String genSnapshotPath = artifacts.getArtifactPath(
Artifact.genSnapshot,
platform: TargetPlatform.ios,
mode: BuildMode.profile,
);
processManager.addCommands(<FakeCommand>[
FakeCommand(command: <String>[
artifacts.getArtifactPath(Artifact.genSnapshot,
platform: TargetPlatform.ios, mode: BuildMode.profile) +
'_armv7',
'${genSnapshotPath}_armv7',
'--deterministic',
'--snapshot_kind=app-aot-assembly',
'--assembly=$assembly',
@@ -352,11 +363,14 @@ void main() {
testWithoutContext('builds iOS armv7 snapshot with obfuscate', () async {
final String outputPath = fileSystem.path.join('build', 'foo');
final String assembly = fileSystem.path.join(outputPath, 'snapshot_assembly.S');
final String genSnapshotPath = artifacts.getArtifactPath(
Artifact.genSnapshot,
platform: TargetPlatform.ios,
mode: BuildMode.profile,
);
processManager.addCommands(<FakeCommand>[
FakeCommand(command: <String>[
artifacts.getArtifactPath(Artifact.genSnapshot,
platform: TargetPlatform.ios, mode: BuildMode.profile) +
'_armv7',
'${genSnapshotPath}_armv7',
'--deterministic',
'--snapshot_kind=app-aot-assembly',
'--assembly=$assembly',
@@ -408,11 +422,14 @@ void main() {
testWithoutContext('builds iOS armv7 snapshot', () async {
final String outputPath = fileSystem.path.join('build', 'foo');
final String genSnapshotPath = artifacts.getArtifactPath(
Artifact.genSnapshot,
platform: TargetPlatform.ios,
mode: BuildMode.release,
);
processManager.addCommands(<FakeCommand>[
FakeCommand(command: <String>[
artifacts.getArtifactPath(Artifact.genSnapshot,
platform: TargetPlatform.ios, mode: BuildMode.release) +
'_armv7',
'${genSnapshotPath}_armv7',
'--deterministic',
'--snapshot_kind=app-aot-assembly',
'--assembly=${fileSystem.path.join(outputPath, 'snapshot_assembly.S')}',
@@ -462,11 +479,14 @@ void main() {
testWithoutContext('builds iOS arm64 snapshot', () async {
final String outputPath = fileSystem.path.join('build', 'foo');
final String genSnapshotPath = artifacts.getArtifactPath(
Artifact.genSnapshot,
platform: TargetPlatform.ios,
mode: BuildMode.release,
);
processManager.addCommands(<FakeCommand>[
FakeCommand(command: <String>[
artifacts.getArtifactPath(Artifact.genSnapshot,
platform: TargetPlatform.ios, mode: BuildMode.release) +
'_arm64',
'${genSnapshotPath}_arm64',
'--deterministic',
'--snapshot_kind=app-aot-assembly',
'--assembly=${fileSystem.path.join(outputPath, 'snapshot_assembly.S')}',

View File

@@ -19,7 +19,7 @@ void main() {
);
bufferLogger.printStatus('0123456789' * 8);
expect(bufferLogger.statusText, equals(('0123456789' * 4 + '\n') * 2));
expect(bufferLogger.statusText, equals(('${'0123456789' * 4}\n') * 2));
});
testWithoutContext('can turn off wrapping', () async {

View File

@@ -78,17 +78,18 @@ void main() {
..createSync(recursive: true)
..writeAsStringSync('{"configVersion": 2, "packages":[]}');
final String build = androidEnvironment.buildDir.path;
final String flutterPatchedSdkPath = artifacts.getArtifactPath(
Artifact.flutterPatchedSdkPath,
platform: TargetPlatform.android_arm,
mode: BuildMode.profile,
);
processManager.addCommands(<FakeCommand>[
FakeCommand(command: <String>[
artifacts.getHostArtifact(HostArtifact.engineDartBinary).path,
'--disable-dart-dev',
artifacts.getArtifactPath(Artifact.frontendServerSnapshotForEngineDartSdk),
'--sdk-root',
artifacts.getArtifactPath(
Artifact.flutterPatchedSdkPath,
platform: TargetPlatform.android_arm,
mode: BuildMode.profile,
) + '/',
'$flutterPatchedSdkPath/',
'--target=flutter',
'--no-print-incremental-dependencies',
...buildModeOptions(BuildMode.profile, <String>[]),
@@ -113,17 +114,18 @@ void main() {
..createSync(recursive: true)
..writeAsStringSync('{"configVersion": 2, "packages":[]}');
final String build = androidEnvironment.buildDir.path;
final String flutterPatchedSdkPath = artifacts.getArtifactPath(
Artifact.flutterPatchedSdkPath,
platform: TargetPlatform.android_arm,
mode: BuildMode.profile,
);
processManager.addCommands(<FakeCommand>[
FakeCommand(command: <String>[
artifacts.getHostArtifact(HostArtifact.engineDartBinary).path,
'--disable-dart-dev',
artifacts.getArtifactPath(Artifact.frontendServerSnapshotForEngineDartSdk),
'--sdk-root',
artifacts.getArtifactPath(
Artifact.flutterPatchedSdkPath,
platform: TargetPlatform.android_arm,
mode: BuildMode.profile,
) + '/',
'$flutterPatchedSdkPath/',
'--target=flutter',
'--no-print-incremental-dependencies',
...buildModeOptions(BuildMode.profile, <String>[]),
@@ -149,17 +151,18 @@ void main() {
..createSync(recursive: true)
..writeAsStringSync('{"configVersion": 2, "packages":[]}');
final String build = androidEnvironment.buildDir.path;
final String flutterPatchedSdkPath = artifacts.getArtifactPath(
Artifact.flutterPatchedSdkPath,
platform: TargetPlatform.android_arm,
mode: BuildMode.profile,
);
processManager.addCommands(<FakeCommand>[
FakeCommand(command: <String>[
artifacts.getHostArtifact(HostArtifact.engineDartBinary).path,
'--disable-dart-dev',
artifacts.getArtifactPath(Artifact.frontendServerSnapshotForEngineDartSdk),
'--sdk-root',
artifacts.getArtifactPath(
Artifact.flutterPatchedSdkPath,
platform: TargetPlatform.android_arm,
mode: BuildMode.profile,
) + '/',
'$flutterPatchedSdkPath/',
'--target=flutter',
'--no-print-incremental-dependencies',
...buildModeOptions(BuildMode.profile, <String>[]),
@@ -186,17 +189,18 @@ void main() {
..createSync(recursive: true)
..writeAsStringSync('{"configVersion": 2, "packages":[]}');
final String build = androidEnvironment.buildDir.path;
final String flutterPatchedSdkPath = artifacts.getArtifactPath(
Artifact.flutterPatchedSdkPath,
platform: TargetPlatform.android_arm,
mode: BuildMode.profile,
);
processManager.addCommands(<FakeCommand>[
FakeCommand(command: <String>[
artifacts.getHostArtifact(HostArtifact.engineDartBinary).path,
'--disable-dart-dev',
artifacts.getArtifactPath(Artifact.frontendServerSnapshotForEngineDartSdk),
'--sdk-root',
artifacts.getArtifactPath(
Artifact.flutterPatchedSdkPath,
platform: TargetPlatform.android_arm,
mode: BuildMode.profile,
) + '/',
'$flutterPatchedSdkPath/',
'--target=flutter',
'--no-print-incremental-dependencies',
...buildModeOptions(BuildMode.profile, <String>[]),
@@ -225,17 +229,18 @@ void main() {
..createSync(recursive: true)
..writeAsStringSync('{"configVersion": 2, "packages":[]}');
final String build = androidEnvironment.buildDir.path;
final String flutterPatchedSdkPath = artifacts.getArtifactPath(
Artifact.flutterPatchedSdkPath,
platform: TargetPlatform.android_arm,
mode: BuildMode.debug,
);
processManager.addCommands(<FakeCommand>[
FakeCommand(command: <String>[
artifacts.getHostArtifact(HostArtifact.engineDartBinary).path,
'--disable-dart-dev',
artifacts.getArtifactPath(Artifact.frontendServerSnapshotForEngineDartSdk),
'--sdk-root',
artifacts.getArtifactPath(
Artifact.flutterPatchedSdkPath,
platform: TargetPlatform.android_arm,
mode: BuildMode.debug,
) + '/',
'$flutterPatchedSdkPath/',
'--target=flutter',
'--no-print-incremental-dependencies',
...buildModeOptions(BuildMode.debug, <String>[]),
@@ -262,17 +267,18 @@ void main() {
..createSync(recursive: true)
..writeAsStringSync('{"configVersion": 2, "packages":[]}');
final String build = androidEnvironment.buildDir.path;
final String flutterPatchedSdkPath = artifacts.getArtifactPath(
Artifact.flutterPatchedSdkPath,
platform: TargetPlatform.darwin,
mode: BuildMode.debug,
);
processManager.addCommands(<FakeCommand>[
FakeCommand(command: <String>[
artifacts.getHostArtifact(HostArtifact.engineDartBinary).path,
'--disable-dart-dev',
artifacts.getArtifactPath(Artifact.frontendServerSnapshotForEngineDartSdk),
'--sdk-root',
artifacts.getArtifactPath(
Artifact.flutterPatchedSdkPath,
platform: TargetPlatform.darwin,
mode: BuildMode.debug,
) + '/',
'$flutterPatchedSdkPath/',
'--target=flutter',
'--no-print-incremental-dependencies',
...buildModeOptions(BuildMode.debug, <String>[]),
@@ -311,17 +317,18 @@ void main() {
logger: logger,
);
final String build = testEnvironment.buildDir.path;
final String flutterPatchedSdkPath = artifacts.getArtifactPath(
Artifact.flutterPatchedSdkPath,
platform: TargetPlatform.android_arm,
mode: BuildMode.debug,
);
processManager.addCommands(<FakeCommand>[
FakeCommand(command: <String>[
artifacts.getHostArtifact(HostArtifact.engineDartBinary).path,
'--disable-dart-dev',
artifacts.getArtifactPath(Artifact.frontendServerSnapshotForEngineDartSdk),
'--sdk-root',
artifacts.getArtifactPath(
Artifact.flutterPatchedSdkPath,
platform: TargetPlatform.android_arm,
mode: BuildMode.debug,
) + '/',
'$flutterPatchedSdkPath/',
'--target=flutter',
'--no-print-incremental-dependencies',
...buildModeOptions(BuildMode.debug, <String>[]),

View File

@@ -68,8 +68,8 @@ void main() {
final Directory installedDirectory = fileSystem.directory(installPath);
installedDirectory.createSync(recursive: true);
// Create plugin JAR file for Flutter and Dart plugin.
createIntellijFlutterPluginJar(pluginPath + '/flutter-intellij/lib/flutter-intellij.jar', fileSystem, version: '50.0');
createIntellijDartPluginJar(pluginPath + '/Dart/lib/Dart.jar', fileSystem);
createIntellijFlutterPluginJar('$pluginPath/flutter-intellij/lib/flutter-intellij.jar', fileSystem, version: '50.0');
createIntellijDartPluginJar('$pluginPath/Dart/lib/Dart.jar', fileSystem);
final Iterable<DoctorValidator> installed = IntelliJValidatorOnLinux.installed(
fileSystem: fileSystem,
@@ -95,8 +95,8 @@ void main() {
final Directory installedDirectory = fileSystem.directory(installPath);
installedDirectory.createSync(recursive: true);
// Create plugin JAR file for Flutter and Dart plugin.
createIntellijFlutterPluginJar(pluginPath + '/flutter-intellij/lib/flutter-intellij.jar', fileSystem, version: '50.0');
createIntellijDartPluginJar(pluginPath + '/Dart/lib/Dart.jar', fileSystem);
createIntellijFlutterPluginJar('$pluginPath/flutter-intellij/lib/flutter-intellij.jar', fileSystem, version: '50.0');
createIntellijDartPluginJar('$pluginPath/Dart/lib/Dart.jar', fileSystem);
final Iterable<DoctorValidator> installed = IntelliJValidatorOnLinux.installed(
fileSystem: fileSystem,
@@ -122,8 +122,8 @@ void main() {
final Directory installedDirectory = fileSystem.directory(installPath);
installedDirectory.createSync(recursive: true);
// Create plugin JAR file for Flutter and Dart plugin.
createIntellijFlutterPluginJar(pluginPath + '/flutter-intellij/lib/flutter-intellij.jar', fileSystem, version: '50.0');
createIntellijDartPluginJar(pluginPath + '/Dart/lib/Dart.jar', fileSystem);
createIntellijFlutterPluginJar('$pluginPath/flutter-intellij/lib/flutter-intellij.jar', fileSystem, version: '50.0');
createIntellijDartPluginJar('$pluginPath/Dart/lib/Dart.jar', fileSystem);
final Iterable<DoctorValidator> installed = IntelliJValidatorOnLinux.installed(
fileSystem: fileSystem,
@@ -149,8 +149,8 @@ void main() {
final Directory installedDirectory = fileSystem.directory(installPath);
installedDirectory.createSync(recursive: true);
// Create plugin JAR file for Flutter and Dart plugin.
createIntellijFlutterPluginJar(pluginPath + '/flutter-intellij/lib/flutter-intellij.jar', fileSystem, version: '50.0');
createIntellijDartPluginJar(pluginPath + '/Dart/lib/Dart.jar', fileSystem);
createIntellijFlutterPluginJar('$pluginPath/flutter-intellij/lib/flutter-intellij.jar', fileSystem, version: '50.0');
createIntellijDartPluginJar('$pluginPath/Dart/lib/Dart.jar', fileSystem);
final Iterable<DoctorValidator> installed = IntelliJValidatorOnLinux.installed(
fileSystem: fileSystem,
@@ -175,8 +175,8 @@ void main() {
.writeAsStringSync(installPath, flush: true);
final Directory installedDirectory = fileSystem.directory(installPath);
installedDirectory.createSync(recursive: true);
createIntellijFlutterPluginJar(pluginPath + '/flutter-intellij/lib/flutter-intellij.jar', fileSystem, version: '50.0');
createIntellijDartPluginJar(pluginPath + '/Dart/lib/Dart.jar', fileSystem);
createIntellijFlutterPluginJar('$pluginPath/flutter-intellij/lib/flutter-intellij.jar', fileSystem, version: '50.0');
createIntellijDartPluginJar('$pluginPath/Dart/lib/Dart.jar', fileSystem);
final Iterable<DoctorValidator> installed = IntelliJValidatorOnWindows.installed(
fileSystem: fileSystem,

View File

@@ -2101,7 +2101,7 @@ void main() {
.uri.toString());
expect(residentCompiler.targetModel, TargetModel.dartdevc);
expect(residentCompiler.sdkRoot,
globals.artifacts.getHostArtifact(HostArtifact.flutterWebSdk).path + '/');
'${globals.artifacts.getHostArtifact(HostArtifact.flutterWebSdk).path}/');
expect(residentCompiler.platformDill, 'file:///HostArtifact.webPlatformKernelDill');
}, overrides: <Type, Generator>{
Artifacts: () => Artifacts.test(),
@@ -2132,7 +2132,7 @@ void main() {
.uri.toString());
expect(residentCompiler.targetModel, TargetModel.dartdevc);
expect(residentCompiler.sdkRoot,
globals.artifacts.getHostArtifact(HostArtifact.flutterWebSdk).path + '/');
'${globals.artifacts.getHostArtifact(HostArtifact.flutterWebSdk).path}/');
expect(residentCompiler.platformDill, 'file:///HostArtifact.webPlatformSoundKernelDill');
}, overrides: <Type, Generator>{
Artifacts: () => Artifacts.test(),

View File

@@ -950,7 +950,7 @@ void main() {
expect(terminalHandler.logger.statusText, equals(''));
terminalHandler.logger.printStatus(message);
expect(terminalHandler.logger.statusText, equals(message + '\n')); // printStatus makes a newline
expect(terminalHandler.logger.statusText, equals('$message\n')); // printStatus makes a newline
await terminalHandler.processTerminalInput('c');
expect(terminalHandler.logger.statusText, equals(''));

View File

@@ -75,17 +75,17 @@ baz=qux
const int _lineLength = 40;
const String _longLine = 'This is a long line that needs to be wrapped.';
final String _longLineWithNewlines = 'This is a long line with newlines that\n'
'needs to be wrapped.\n\n' +
'0123456789' * 5;
'needs to be wrapped.\n\n'
'${'0123456789' * 5}';
final String _longAnsiLineWithNewlines = '${AnsiTerminal.red}This${AnsiTerminal.resetAll} is a long line with newlines that\n'
'needs to be wrapped.\n\n'
'${AnsiTerminal.green}0123456789${AnsiTerminal.resetAll}' +
'0123456789' * 3 +
'${AnsiTerminal.green}0123456789${AnsiTerminal.resetAll}'
'${'0123456789' * 3}'
'${AnsiTerminal.green}0123456789${AnsiTerminal.resetAll}';
const String _onlyAnsiSequences = '${AnsiTerminal.red}${AnsiTerminal.resetAll}';
final String _indentedLongLineWithNewlines = ' This is an indented long line with newlines that\n'
'needs to be wrapped.\n\tAnd preserves tabs.\n \n ' +
'0123456789' * 5;
'needs to be wrapped.\n\tAnd preserves tabs.\n \n '
'${'0123456789' * 5}';
const String _shortLine = 'Short line.';
const String _indentedLongLine = ' This is an indented long line that needs to be '
'wrapped and indentation preserved.';
@@ -135,7 +135,7 @@ wrapped.'''));
});
testWithoutContext('refuses to wrap to a column smaller than 10 characters', () {
expect(wrapText('$_longLine ' + '0123456789' * 4, columnWidth: 1, shouldWrap: true), equals('''
expect(wrapText('$_longLine ${'0123456789' * 4}', columnWidth: 1, shouldWrap: true), equals('''
This is a
long line
that needs
@@ -252,7 +252,7 @@ needs to be wrapped.
testWithoutContext('', () {
expect(wrapText(
' ' * 7 + 'abc def ghi', columnWidth: 20, hangingIndent: 5, indent: 3, shouldWrap: true),
'${' ' * 7}abc def ghi', columnWidth: 20, hangingIndent: 5, indent: 3, shouldWrap: true),
equals(
' abc def\n'
' ghi'

View File

@@ -39,7 +39,7 @@ void main() {
'message': 'some message',
};
final FakeProcess mockProcess = createFakeProcess(jsonEncode(expectedResponse) + '\n');
final FakeProcess mockProcess = createFakeProcess('${jsonEncode(expectedResponse)}\n');
final MemoryIOSink ioSink = mockProcess.stdin as MemoryIOSink;
final TestGoldenComparatorProcess process = TestGoldenComparatorProcess(mockProcess, logger: BufferLogger.test());
@@ -62,7 +62,7 @@ void main() {
'message': 'some other message',
};
final FakeProcess mockProcess = createFakeProcess(jsonEncode(expectedResponse1) + '\n' + jsonEncode(expectedResponse2) + '\n');
final FakeProcess mockProcess = createFakeProcess('${jsonEncode(expectedResponse1)}\n${jsonEncode(expectedResponse2)}\n');
final MemoryIOSink ioSink = mockProcess.stdin as MemoryIOSink;
final TestGoldenComparatorProcess process = TestGoldenComparatorProcess(mockProcess, logger: BufferLogger.test());

View File

@@ -45,7 +45,7 @@ void main() {
'--non-interactive',
'--packages=.dart_tool/package_config.json',
'compiler_output'
], stdout: jsonEncode(expectedResponse) + '\n',
], stdout: '${jsonEncode(expectedResponse)}\n',
));
final TestGoldenComparator comparator = TestGoldenComparator(
@@ -73,7 +73,7 @@ void main() {
'--non-interactive',
'--packages=.dart_tool/package_config.json',
'compiler_output'
], stdout: jsonEncode(expectedResponse) + '\n',
], stdout: '${jsonEncode(expectedResponse)}\n',
));
final TestGoldenComparator comparator = TestGoldenComparator(
@@ -105,7 +105,7 @@ void main() {
'--non-interactive',
'--packages=.dart_tool/package_config.json',
'compiler_output'
], stdout: jsonEncode(expectedResponse1) + '\n' + jsonEncode(expectedResponse2) + '\n',
], stdout: '${jsonEncode(expectedResponse1)}\n${jsonEncode(expectedResponse2)}\n',
));
final TestGoldenComparator comparator = TestGoldenComparator(
@@ -140,7 +140,7 @@ void main() {
'--non-interactive',
'--packages=.dart_tool/package_config.json',
'compiler_output'
], stdout: jsonEncode(expectedResponse1) + '\n',
], stdout: '${jsonEncode(expectedResponse1)}\n',
));
processManager.addCommand(FakeCommand(
command: const <String>[
@@ -149,7 +149,7 @@ void main() {
'--non-interactive',
'--packages=.dart_tool/package_config.json',
'compiler_output'
], stdout: jsonEncode(expectedResponse2) + '\n',
], stdout: '${jsonEncode(expectedResponse2)}\n',
));
final TestGoldenComparator comparator = TestGoldenComparator(
@@ -182,7 +182,7 @@ void main() {
'--non-interactive',
'--packages=.dart_tool/package_config.json',
'compiler_output'
], stdout: jsonEncode(expectedResponse) + '\n',
], stdout: '${jsonEncode(expectedResponse)}\n',
stdin: stdin,
));

View File

@@ -126,7 +126,7 @@ Future<void> _ensureFlutterToolsSnapshot() async {
final File snapshotFile = globals.fs.file(flutterToolsSnapshotPath);
if (snapshotFile.existsSync()) {
snapshotFile.renameSync(flutterToolsSnapshotPath + '.bak');
snapshotFile.renameSync('$flutterToolsSnapshotPath.bak');
}
final List<String> snapshotArgs = <String>[
@@ -157,7 +157,7 @@ Future<void> _restoreFlutterToolsSnapshot() async {
);
final File snapshotBackup =
globals.fs.file(flutterToolsSnapshotPath + '.bak');
globals.fs.file('$flutterToolsSnapshotPath.bak');
if (!snapshotBackup.existsSync()) {
// No backup to restore.
return;

View File

@@ -113,7 +113,7 @@ class Multiple extends Transition {
@override
String toString() {
return _originalPatterns.map(describe).join(', ') + ' (matched ${_originalPatterns.length - patterns.length} so far)';
return '${_originalPatterns.map(describe).join(', ')} (matched ${_originalPatterns.length - patterns.length} so far)';
}
}

View File

@@ -68,11 +68,11 @@ abstract class FlutterTestDriver {
String lastTime = '';
void _debugPrint(String message, { String topic = '' }) {
const int maxLength = 2500;
final String truncatedMessage = message.length > maxLength ? message.substring(0, maxLength) + '...' : message;
final String truncatedMessage = message.length > maxLength ? '${message.substring(0, maxLength)}...' : message;
final String line = '${topic.padRight(10)} $truncatedMessage';
_allMessages.add(line);
final int timeInSeconds = DateTime.now().difference(startTime).inSeconds;
String time = timeInSeconds.toString().padLeft(5) + 's ';
String time = '${timeInSeconds.toString().padLeft(5)}s ';
if (time == lastTime) {
time = ' ' * time.length;
} else {

View File

@@ -194,7 +194,7 @@ void main() {
});
testWithoutContext('flutter test should run all tests inside of a directory with no trailing slash', () async {
final ProcessResult result = await _runFlutterTest(null, automatedTestsDirectory, flutterTestDirectory + '/child_directory',
final ProcessResult result = await _runFlutterTest(null, automatedTestsDirectory, '$flutterTestDirectory/child_directory',
extraArguments: const <String>['--verbose']);
final String stdout = result.stdout as String;
if ((!stdout.contains('+2: All tests passed')) ||

View File

@@ -410,7 +410,7 @@ class _FakeHttpClientRequest implements HttpClientRequest {
@override
void writeln([Object? object = '']) {
_body.addAll(utf8.encode(object.toString() + '\n'));
_body.addAll(utf8.encode('$object\n'));
}
}

View File

@@ -18,7 +18,7 @@ void validatePubspecForPlugin({
String? webFileName,
}) {
final FlutterManifest manifest =
FlutterManifest.createFromPath(projectDir + '/pubspec.yaml', fileSystem: globals.fs, logger: globals.logger)!;
FlutterManifest.createFromPath('$projectDir/pubspec.yaml', fileSystem: globals.fs, logger: globals.logger)!;
final YamlMap platformsMap = YamlMap.wrap(manifest.supportedPlatforms!);
for (final String platform in expectedPlatforms) {
expect(platformsMap[platform], isNotNull);