Unverified Commit ae06c19a authored by Alexandre Ardhuin's avatar Alexandre Ardhuin Committed by GitHub

enable unnecessary_string_escapes and use_raw_strings (#68302)

parent a4ac7cce
......@@ -209,7 +209,7 @@ linter:
- unnecessary_parenthesis
# - unnecessary_raw_strings # not yet tested
- unnecessary_statements
# - unnecessary_string_escapes # not yet tested
- unnecessary_string_escapes
- unnecessary_string_interpolations
- unnecessary_this
- unrelated_type_equality_checks
......@@ -219,7 +219,7 @@ linter:
- use_is_even_rather_than_modulo
# - use_key_in_widget_constructors # not yet tested
- use_late_for_private_fields_and_variables
# - use_raw_strings # not yet tested
- use_raw_strings
- use_rethrow_when_possible
# - use_setters_to_change_properties # not yet tested
# - use_string_buffers # has false positives: https://github.com/dart-lang/sdk/issues/34182
......
......@@ -390,6 +390,19 @@ class $classNamePrefix$camelCaseName extends $superClass {''';
/// foo$bar = 'foo\$bar'
/// ```
String generateString(String value) {
if (<String>['\n', '\f', '\t', '\r', '\b'].every((String pattern) => !value.contains(pattern))) {
final bool hasDollar = value.contains(r'$');
final bool hasBackslash = value.contains(r'\');
final bool hasQuote = value.contains("'");
final bool hasDoubleQuote = value.contains('"');
if (!hasQuote) {
return hasBackslash || hasDollar ? "r'$value'" : "'$value'";
}
if (!hasDoubleQuote) {
return hasBackslash || hasDollar ? 'r"$value"' : '"$value"';
}
}
const String backslash = '__BACKSLASH__';
assert(
!value.contains(backslash),
......@@ -401,17 +414,17 @@ String generateString(String value) {
value = value
// Replace backslashes with a placeholder for now to properly parse
// other special characters.
.replaceAll('\\', backslash)
.replaceAll('\$', '\\\$')
.replaceAll("'", "\\'")
.replaceAll('"', '\\"')
.replaceAll('\n', '\\n')
.replaceAll('\f', '\\f')
.replaceAll('\t', '\\t')
.replaceAll('\r', '\\r')
.replaceAll('\b', '\\b')
.replaceAll(r'\', backslash)
.replaceAll(r'$', r'\$')
.replaceAll("'", r"\'")
.replaceAll('"', r'\"')
.replaceAll('\n', r'\n')
.replaceAll('\f', r'\f')
.replaceAll('\t', r'\t')
.replaceAll('\r', r'\r')
.replaceAll('\b', r'\b')
// Reintroduce escaped backslashes into generated Dart string.
.replaceAll(backslash, '\\\\');
.replaceAll(backslash, r'\\');
return "'$value'";
}
......
......@@ -565,7 +565,7 @@ class Actions extends StatefulWidget {
if (action == null) {
throw FlutterError('Unable to find an action for a $type in an $Actions widget '
'in the given context.\n'
"$Actions.find() was called on a context that doesn\'t contain an "
"$Actions.find() was called on a context that doesn't contain an "
'$Actions widget with a mapping for the given intent type.\n'
'The context used was:\n'
' $context\n'
......
......@@ -151,7 +151,7 @@ Future<void> main() async {
FlutterError.dumpErrorToConsole(FlutterErrorDetails(
exception: getAssertionErrorWithoutMessage(),
));
expect(console.join('\n'), matches("Another exception was thrown: '[^']+flutter/test/foundation/error_reporting_test\\.dart': Failed assertion: line [0-9]+ pos [0-9]+: 'false': is not true\\."));
expect(console.join('\n'), matches(r"Another exception was thrown: '[^']+flutter/test/foundation/error_reporting_test\.dart': Failed assertion: line [0-9]+ pos [0-9]+: 'false': is not true\."));
console.clear();
FlutterError.resetErrorCount();
});
......
......@@ -160,9 +160,9 @@ const String asyncStackString = '''
#37 _startIsolate.<anonymous closure> (dart:isolate-patch/isolate_patch.dart:307:19)
#38 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:174:12)''';
const String mangledStackString = '''
const String mangledStackString = r'''
dart:async/future_impl.dart 23:44 _Completer.completeError
test\\bindings_async_gap_test.dart 42:17 main.<fn>.<fn>
test\bindings_async_gap_test.dart 42:17 main.<fn>.<fn>
package:flutter_test/src/binding.dart 744:19 TestWidgetsFlutterBinding._runTestBody
===== asynchronous gap ===========================
dart:async/zone.dart 1121:19 _CustomZone.registerUnaryCallback
......
......@@ -199,7 +199,7 @@ void main() {
'args': <dynamic>[
1,
jsonDecode(
'{"action": "actionCommand", "data": {\"input_context\" : \"abcdefg\"}}')
'{"action": "actionCommand", "data": {"input_context" : "abcdefg"}}')
],
'method': 'TextInputClient.performPrivateCommand',
});
......@@ -226,7 +226,7 @@ void main() {
'args': <dynamic>[
1,
jsonDecode(
'{"action": "actionCommand", "data": {\"input_context\" : 0.5}}')
'{"action": "actionCommand", "data": {"input_context" : 0.5}}')
],
'method': 'TextInputClient.performPrivateCommand',
});
......@@ -254,7 +254,7 @@ void main() {
'args': <dynamic>[
1,
jsonDecode(
'{"action": "actionCommand", "data": {\"input_context\" : ["abc", "efg"]}}')
'{"action": "actionCommand", "data": {"input_context" : ["abc", "efg"]}}')
],
'method': 'TextInputClient.performPrivateCommand',
});
......@@ -283,7 +283,7 @@ void main() {
'args': <dynamic>[
1,
jsonDecode(
'{"action": "actionCommand", "data": {\"input_context\" : "abc"}}')
'{"action": "actionCommand", "data": {"input_context" : "abc"}}')
],
'method': 'TextInputClient.performPrivateCommand',
});
......@@ -312,7 +312,7 @@ void main() {
'args': <dynamic>[
1,
jsonDecode(
'{"action": "actionCommand", "data": {\"input_context\" : [0.5, 0.8]}}')
'{"action": "actionCommand", "data": {"input_context" : [0.5, 0.8]}}')
],
'method': 'TextInputClient.performPrivateCommand',
});
......
......@@ -23,7 +23,7 @@ import 'common.dart';
/// Magical timeout value that's different from the default.
const Duration _kTestTimeout = Duration(milliseconds: 1234);
const String _kSerializedTestTimeout = '1234';
const String _kWebScriptPrefix = "window.\$flutterDriver('";
const String _kWebScriptPrefix = r"window.$flutterDriver('";
const String _kWebScriptSuffix = "')";
void main() {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -347,7 +347,7 @@ class _WindowsUtils extends OperatingSystemUtils {
// `where` could be missing if system32 is not on the PATH.
throwToolExit(
'Cannot find the executable for `where`. This can happen if the System32 '
'folder (e.g. C:\\Windows\\System32 ) is removed from the PATH environment '
r'folder (e.g. C:\Windows\System32 ) is removed from the PATH environment '
'variable. Ensure that this is present and then try again after restarting '
'the terminal and/or IDE.'
);
......
......@@ -110,7 +110,7 @@ class AttachCommand extends FlutterCommand {
final String name = 'attach';
@override
final String description = '''
final String description = r'''
Attach to a running app.
For attaching to Android or iOS devices, simply using `flutter attach` is
......@@ -118,13 +118,13 @@ usually sufficient. The tool will search for a running Flutter app or module,
if available. Otherwise, the tool will wait for the next Flutter app or module
to launch before attaching.
For Fuchsia, the module name must be provided, e.g. `\$flutter attach
For Fuchsia, the module name must be provided, e.g. `$flutter attach
--module=mod_name`. This can be called either before or after the application
is started.
If the app or module is already running and the specific observatory port is
known, it can be explicitly provided to attach via the command-line, e.g.
`\$ flutter attach --debug-port 12345`''';
`$ flutter attach --debug-port 12345`''';
int get debugPort {
if (argResults['debug-port'] == null) {
......
......@@ -591,7 +591,7 @@ class FuchsiaDevice extends Device {
if (_cachedHostAddress != null) {
return _cachedHostAddress;
}
final RunResult result = await shell('echo \$SSH_CONNECTION');
final RunResult result = await shell(r'echo $SSH_CONNECTION');
void fail() {
throwToolExit('Failed to get local address, aborting.\n$result');
}
......
......@@ -91,9 +91,9 @@ class RemoveFrameworkLinkAndEmbeddingMigration extends IOSMigrator {
}
// Embed and thin frameworks in a script instead of using Xcode's link / embed build phases.
const String thinBinaryScript = 'xcode_backend.sh\\" thin';
const String thinBinaryScript = r'xcode_backend.sh\" thin';
if (line.contains(thinBinaryScript) && !line.contains(' embed')) {
return line.replaceFirst(thinBinaryScript, 'xcode_backend.sh\\" embed_and_thin');
return line.replaceFirst(thinBinaryScript, r'xcode_backend.sh\" embed_and_thin');
}
if (line.contains('/* App.framework ') || line.contains('/* Flutter.framework ')) {
......
......@@ -181,7 +181,7 @@ List<String> _xcodeBuildSettingsLines({
// iOS does not link on Flutter in any build phase. Add the linker flag.
if (!useMacOSConfig) {
xcodeBuildSettings.add('OTHER_LDFLAGS=\$(inherited) -framework Flutter');
xcodeBuildSettings.add(r'OTHER_LDFLAGS=$(inherited) -framework Flutter');
}
if (!project.isModule) {
......
......@@ -23,8 +23,8 @@ import 'package:intl/intl.dart' as intl;
/// Callers can lookup localized strings with an instance of @(class) returned
/// by `@(class).of(context)`.
///
/// Applications need to include `@(class).delegate()` in their app\'s
/// localizationDelegates list, and the locales they support in the app\'s
/// Applications need to include `@(class).delegate()` in their app's
/// localizationDelegates list, and the locales they support in the app's
/// supportedLocales list. For example:
///
/// ```
......@@ -215,17 +215,17 @@ const String loadBodyDeferredLoadingTemplate = '''return @(lookupName)(locale);'
// DELEGATE LOOKUP TEMPLATES
const String lookupFunctionTemplate = '''
const String lookupFunctionTemplate = r'''
@(class) @(lookupName)(Locale locale) {
@(lookupBody)
assert(false, '@(class).delegate failed to load unsupported locale "\$locale"');
assert(false, '@(class).delegate failed to load unsupported locale "$locale"');
return null;
}''';
const String lookupFunctionDeferredLoadingTemplate = '''
const String lookupFunctionDeferredLoadingTemplate = r'''
Future<@(class)> @(lookupName)(Locale locale) {
@(lookupBody)
assert(false, '@(class).delegate failed to load unsupported locale "\$locale"');
assert(false, '@(class).delegate failed to load unsupported locale "$locale"');
return null;
}''';
......
......@@ -261,6 +261,19 @@ String describeLocale(String tag) {
/// foo$bar = 'foo\$bar'
/// ```
String generateString(String value) {
if (<String>['\n', '\f', '\t', '\r', '\b'].every((String pattern) => !value.contains(pattern))) {
final bool hasDollar = value.contains(r'$');
final bool hasBackslash = value.contains(r'\');
final bool hasQuote = value.contains("'");
final bool hasDoubleQuote = value.contains('"');
if (!hasQuote) {
return hasBackslash || hasDollar ? "r'$value'" : "'$value'";
}
if (!hasDoubleQuote) {
return hasBackslash || hasDollar ? 'r"$value"' : '"$value"';
}
}
const String backslash = '__BACKSLASH__';
assert(
!value.contains(backslash),
......@@ -272,17 +285,17 @@ String generateString(String value) {
value = value
// Replace backslashes with a placeholder for now to properly parse
// other special characters.
.replaceAll('\\', backslash)
.replaceAll('\$', '\\\$')
.replaceAll("'", "\\'")
.replaceAll('"', '\\"')
.replaceAll('\n', '\\n')
.replaceAll('\f', '\\f')
.replaceAll('\t', '\\t')
.replaceAll('\r', '\\r')
.replaceAll('\b', '\\b')
.replaceAll(r'\', backslash)
.replaceAll(r'$', r'\$')
.replaceAll("'", r"\'")
.replaceAll('"', r'\"')
.replaceAll('\n', r'\n')
.replaceAll('\f', r'\f')
.replaceAll('\t', r'\t')
.replaceAll('\r', r'\r')
.replaceAll('\b', r'\b')
// Reintroduce escaped backslashes into generated Dart string.
.replaceAll(backslash, '\\\\');
.replaceAll(backslash, r'\\');
return "'$value'";
}
......@@ -312,17 +312,17 @@ void main() {
expect(configLines, containsAll(<String>[
'file(TO_CMAKE_PATH "$_kTestFlutterRoot" FLUTTER_ROOT)',
'file(TO_CMAKE_PATH "${fileSystem.currentDirectory.path}" PROJECT_DIR)',
' "DART_DEFINES=\\"foo.bar%3D2,fizz.far%3D3\\""',
' "DART_OBFUSCATION=\\"true\\""',
' "EXTRA_FRONT_END_OPTIONS=\\"--enable-experiment%3Dnon-nullable\\""',
' "EXTRA_GEN_SNAPSHOT_OPTIONS=\\"--enable-experiment%3Dnon-nullable\\""',
' "SPLIT_DEBUG_INFO=\\"foo/\\""',
' "TRACK_WIDGET_CREATION=\\"true\\""',
' "TREE_SHAKE_ICONS=\\"true\\""',
r' "DART_DEFINES=\"foo.bar%3D2,fizz.far%3D3\""',
r' "DART_OBFUSCATION=\"true\""',
r' "EXTRA_FRONT_END_OPTIONS=\"--enable-experiment%3Dnon-nullable\""',
r' "EXTRA_GEN_SNAPSHOT_OPTIONS=\"--enable-experiment%3Dnon-nullable\""',
r' "SPLIT_DEBUG_INFO=\"foo/\""',
r' "TRACK_WIDGET_CREATION=\"true\""',
r' "TREE_SHAKE_ICONS=\"true\""',
' "FLUTTER_ROOT=\\"$_kTestFlutterRoot\\""',
' "PROJECT_DIR=\\"${fileSystem.currentDirectory.path}\\""',
' "FLUTTER_TARGET=\\"lib/other.dart\\""',
' "BUNDLE_SKSL_PATH=\\"foo/bar.sksl.json\\""',
r' "FLUTTER_TARGET=\"lib/other.dart\""',
r' "BUNDLE_SKSL_PATH=\"foo/bar.sksl.json\""',
]));
}, overrides: <Type, Generator>{
FileSystem: () => fileSystem,
......
......@@ -71,7 +71,7 @@ void main() {
if (platform.isWindows) {
flutterRootUri
..write('/')
..write(canonicalizedFlutterRootPath.replaceAll('\\', '/'));
..write(canonicalizedFlutterRootPath.replaceAll(r'\', '/'));
} else {
flutterRootUri.write(canonicalizedFlutterRootPath);
}
......
......@@ -163,7 +163,7 @@ void main() {
await expectLater(
() async => await realCommandRunner.fetchRemoteRevision(),
throwsToolExit(
message: 'Unable to upgrade Flutter: no origin repository configured\.',
message: 'Unable to upgrade Flutter: no origin repository configured.',
),
);
expect(processManager.hasRemainingExpectations, isFalse);
......
......@@ -37,7 +37,7 @@ final Platform linuxPlatform = FakePlatform(
final Platform windowsPlatform = FakePlatform(
operatingSystem: 'windows',
environment: <String, String>{
'LOCALAPPDATA': 'C:\\Users\\Dash\\AppData\\Local',
'LOCALAPPDATA': r'C:\Users\Dash\AppData\Local',
}
);
......@@ -193,11 +193,11 @@ void main() {
});
testUsingContext('Can discover Android Studio 4.1 location on Windows', () {
windowsFileSystem.file('C:\\Users\\Dash\\AppData\\Local\\Google\\AndroidStudio4.1\\.home')
windowsFileSystem.file(r'C:\Users\Dash\AppData\Local\Google\AndroidStudio4.1\.home')
..createSync(recursive: true)
..writeAsStringSync('C:\\Program Files\\AndroidStudio');
..writeAsStringSync(r'C:\Program Files\AndroidStudio');
windowsFileSystem
.directory('C:\\Program Files\\AndroidStudio')
.directory(r'C:\Program Files\AndroidStudio')
.createSync(recursive: true);
final AndroidStudio studio = AndroidStudio.allInstalled().single;
......
......@@ -29,9 +29,9 @@ final Platform linuxPlatform = FakePlatform(
final Platform windowsPlatform = FakePlatform(
operatingSystem: 'windows',
environment: <String, String>{
'USERPROFILE': 'C:\\Users\\foo',
'APPDATA': 'C:\\Users\\foo\\AppData\\Roaming',
'LOCALAPPDATA': 'C:\\Users\\foo\\AppData\\Local'
'USERPROFILE': r'C:\Users\foo',
'APPDATA': r'C:\Users\foo\AppData\Roaming',
'LOCALAPPDATA': r'C:\Users\foo\AppData\Local'
},
);
......@@ -163,9 +163,9 @@ void main() {
});
testWithoutContext('legacy intellij(<2020) plugins check on windows', () async {
const String cachePath = 'C:\\Users\\foo\\.IntelliJIdea2019.10\\system';
const String installPath = 'C:\\Program Files\\JetBrains\\IntelliJ IDEA Ultimate Edition 2019.10.1';
const String pluginPath = 'C:\\Users\\foo\\.IntelliJIdea2019.10\\config\\plugins';
const String cachePath = r'C:\Users\foo\.IntelliJIdea2019.10\system';
const String installPath = r'C:\Program Files\JetBrains\IntelliJ IDEA Ultimate Edition 2019.10.1';
const String pluginPath = r'C:\Users\foo\.IntelliJIdea2019.10\config\plugins';
final FileSystem fileSystem = MemoryFileSystem.test(style: FileSystemStyle.windows);
final Directory cacheDirectory = fileSystem.directory(cachePath)
......@@ -190,9 +190,9 @@ void main() {
});
testWithoutContext('intellij(2020.1 ~ 2020.2) plugins check on windows (installed via JetBrains ToolBox app)', () async {
const String cachePath = 'C:\\Users\\foo\\AppData\\Local\\JetBrains\\IntelliJIdea2020.10';
const String installPath = 'C:\\Users\\foo\\AppData\\Local\\JetBrains\\Toolbox\\apps\\IDEA-U\\ch-0\\201.0000.00';
const String pluginPath = 'C:\\Users\\foo\\AppData\\Roaming\\JetBrains\\IntelliJIdea2020.10\\plugins';
const String cachePath = r'C:\Users\foo\AppData\Local\JetBrains\IntelliJIdea2020.10';
const String installPath = r'C:\Users\foo\AppData\Local\JetBrains\Toolbox\apps\IDEA-U\ch-0\201.0000.00';
const String pluginPath = r'C:\Users\foo\AppData\Roaming\JetBrains\IntelliJIdea2020.10\plugins';
final FileSystem fileSystem = MemoryFileSystem.test(style: FileSystemStyle.windows);
final Directory cacheDirectory = fileSystem.directory(cachePath)
......@@ -202,8 +202,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 + r'\flutter-intellij\lib\flutter-intellij.jar', fileSystem, version: '50.0');
createIntellijDartPluginJar(pluginPath + r'\Dart\lib\Dart.jar', fileSystem);
final Iterable<DoctorValidator> installed = IntelliJValidatorOnWindows.installed(
fileSystem: fileSystem,
......@@ -217,9 +217,9 @@ void main() {
});
testWithoutContext('intellij(>=2020.3) plugins check on windows (installed via JetBrains ToolBox app and plugins)', () async {
const String cachePath = 'C:\\Users\\foo\\AppData\\Local\\JetBrains\\IntelliJIdea2020.10';
const String installPath = 'C:\\Users\\foo\\AppData\\Local\\JetBrains\\Toolbox\\apps\\IDEA-U\\ch-0\\201.0000.00';
const String pluginPath = 'C:\\Users\\foo\\AppData\\Local\\JetBrains\\Toolbox\\apps\\IDEA-U\\ch-0\\201.0000.00.plugins';
const String cachePath = r'C:\Users\foo\AppData\Local\JetBrains\IntelliJIdea2020.10';
const String installPath = r'C:\Users\foo\AppData\Local\JetBrains\Toolbox\apps\IDEA-U\ch-0\201.0000.00';
const String pluginPath = r'C:\Users\foo\AppData\Local\JetBrains\Toolbox\apps\IDEA-U\ch-0\201.0000.00.plugins';
final FileSystem fileSystem = MemoryFileSystem.test(style: FileSystemStyle.windows);
final Directory cacheDirectory = fileSystem.directory(cachePath)
......@@ -229,8 +229,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 + r'\flutter-intellij\lib\flutter-intellij.jar', fileSystem, version: '50.0');
createIntellijDartPluginJar(pluginPath + r'\Dart\lib\Dart.jar', fileSystem);
final Iterable<DoctorValidator> installed = IntelliJValidatorOnWindows.installed(
fileSystem: fileSystem,
......@@ -244,9 +244,9 @@ void main() {
});
testWithoutContext('intellij(2020.1~) plugins check on windows (installed via installer)', () async {
const String cachePath = 'C:\\Users\\foo\\AppData\\Local\\JetBrains\\IdeaIC2020.10';
const String installPath = 'C:\\Program Files\\JetBrains\\IntelliJ IDEA Community Edition 2020.10.1';
const String pluginPath = 'C:\\Users\\foo\\AppData\\Roaming\\JetBrains\\IdeaIC2020.10\\plugins';
const String cachePath = r'C:\Users\foo\AppData\Local\JetBrains\IdeaIC2020.10';
const String installPath = r'C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2020.10.1';
const String pluginPath = r'C:\Users\foo\AppData\Roaming\JetBrains\IdeaIC2020.10\plugins';
final FileSystem fileSystem = MemoryFileSystem.test(style: FileSystemStyle.windows);
final Directory cacheDirectory = fileSystem.directory(cachePath)
......@@ -256,8 +256,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 + r'\flutter-intellij\lib\flutter-intellij.jar', fileSystem, version: '50.0');
createIntellijDartPluginJar(pluginPath + r'\Dart\lib\Dart.jar', fileSystem);
final Iterable<DoctorValidator> installed = IntelliJValidatorOnWindows.installed(
fileSystem: fileSystem,
......
......@@ -99,8 +99,8 @@ void main () {
});
testWithoutContext('skips migrating script with embed', () {
const String contents = '''
shellScript = "/bin/sh \"\$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\\" embed\\n/bin/sh \"\$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\\" thin";
const String contents = r'''
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed\n/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin";
''';
xcodeProjectInfoFile.writeAsStringSync(contents);
......@@ -116,7 +116,7 @@ shellScript = "/bin/sh \"\$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend
});
testWithoutContext('Xcode project is migrated', () {
xcodeProjectInfoFile.writeAsStringSync('''
xcodeProjectInfoFile.writeAsStringSync(r'''
prefix 3B80C3941E831B6300D905FE
3B80C3951E831B6300D905FE suffix
741F496821356857001E2961
......@@ -128,7 +128,7 @@ keep this 1
741F496221355F47001E2961
9740EEBA1CF902C7004384FC
741F495E21355F27001E2961
shellScript = "/bin/sh \"\$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\\" thin";
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin";
keep this 2
''');
......@@ -141,9 +141,9 @@ keep this 2
expect(iosProjectMigration.migrate(), isTrue);
verifyNever(mockUsage.sendEvent(any, any, label: anyNamed('label'), value: anyNamed('value')));
expect(xcodeProjectInfoFile.readAsStringSync(), '''
expect(xcodeProjectInfoFile.readAsStringSync(), r'''
keep this 1
shellScript = "/bin/sh "\$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\\" embed_and_thin";
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
keep this 2
''');
expect(testLogger.statusText, contains('Upgrading project.pbxproj'));
......
......@@ -726,14 +726,14 @@ Dec 20 17:04:32 md32-11-vm1 Another App[88374]: Ignore this text'''
'--predicate',
logPredicate,
],
stdout: '''
stdout: r'''
},{
"traceID" : 37579774151491588,
"eventMessage" : "Single line message",
"eventType" : "logEvent"
},{
"traceID" : 37579774151491588,
"eventMessage" : "Multi line message\\n continues...\\n continues..."
"eventMessage" : "Multi line message\n continues...\n continues..."
},{
"traceID" : 37579774151491588,
"eventMessage" : "Single line message, not the part of the above",
......
......@@ -565,13 +565,13 @@ Information about project "Runner":
expect(config.existsSync(), isTrue);
final String contents = config.readAsStringSync();
expect(contents.contains('OTHER_LDFLAGS=\$(inherited) -framework Flutter'), isTrue);
expect(contents.contains(r'OTHER_LDFLAGS=$(inherited) -framework Flutter'), isTrue);
final File buildPhaseScript = fs.file('path/to/project/ios/Flutter/flutter_export_environment.sh');
expect(buildPhaseScript.existsSync(), isTrue);
final String buildPhaseScriptContents = buildPhaseScript.readAsStringSync();
expect(buildPhaseScriptContents.contains('OTHER_LDFLAGS=\$(inherited) -framework Flutter'), isTrue);
expect(buildPhaseScriptContents.contains(r'OTHER_LDFLAGS=$(inherited) -framework Flutter'), isTrue);
});
testUsingOsxContext('do not set OTHER_LDFLAGS for macOS', () async {
......
......@@ -759,7 +759,7 @@ void main() {
"underlyingErrors" : [
{
"code" : 5,
"failureReason" : "allowsSecureServices: 1. isConnected: 0. Platform: <DVTPlatform:0x7f804ce32880:'com.apple.platform.iphoneos':<DVTFilePath:0x7f804ce32800:'\/Users\/Applications\/Xcode.app\/Contents\/Developer\/Platforms\/iPhoneOS.platform'>>. DTDKDeviceIdentifierIsIDID: 0",
"failureReason" : "allowsSecureServices: 1. isConnected: 0. Platform: <DVTPlatform:0x7f804ce32880:'com.apple.platform.iphoneos':<DVTFilePath:0x7f804ce32800:'/Users/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform'>>. DTDKDeviceIdentifierIsIDID: 0",
"description" : "📱<DVTiOSDevice (0x7f801f190450), iPhone, iPhone, 13.3 (17C54), d83d5bc53967baa0ee18626ba87b6254b2ab5418> -- Failed _shouldMakeReadyForDevelopment check even though device is not locked by passcode.",
"recoverySuggestion" : "",
"domain" : "com.apple.platform.iphoneos"
......
......@@ -1014,9 +1014,9 @@ flutter:
expect(pluginMakefile.existsSync(), isTrue);
final String contents = pluginMakefile.readAsStringSync();
expect(contents, contains('some_plugin'));
expect(contents, contains('target_link_libraries(\${BINARY_NAME} PRIVATE \${plugin}_plugin)'));
expect(contents, contains('list(APPEND PLUGIN_BUNDLED_LIBRARIES \$<TARGET_FILE:\${plugin}_plugin>)'));
expect(contents, contains('list(APPEND PLUGIN_BUNDLED_LIBRARIES \${\${plugin}_bundled_libraries})'));
expect(contents, contains(r'target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin)'));
expect(contents, contains(r'list(APPEND PLUGIN_BUNDLED_LIBRARIES $<TARGET_FILE:${plugin}_plugin>)'));
expect(contents, contains(r'list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries})'));
}, overrides: <Type, Generator>{
FileSystem: () => fs,
ProcessManager: () => FakeProcessManager.any(),
......
......@@ -34,7 +34,7 @@ void main() {
_flutter.lastErrorInfo.contains(
// Looks for stack trace entry of the form:
// test/integration.shard/test_driver.dart 379:18 FlutterTestDriver._waitFor.<fn>
RegExp('^(.+)\/([^\/]+)\.dart \d*:\d*\s*.*\$')
RegExp(r'^(.+)\/([^\/]+)\.dart \d*:\d*\s*.*\$')
),
isFalse
);
......
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