Unverified Commit 7d7ac7c3 authored by Alexandre Ardhuin's avatar Alexandre Ardhuin Committed by GitHub

start multiline strings with newline (#50825)

parent af178605
......@@ -250,7 +250,8 @@ void main() {
final String gsArchivePath = 'gs://flutter_infra/releases/stable/$platformName/$archiveName';
final String jsonPath = path.join(tempDir.absolute.path, releasesName);
final String gsJsonPath = 'gs://flutter_infra/releases/$releasesName';
final String releasesJson = '''{
final String releasesJson = '''
{
"base_url": "https://storage.googleapis.com/flutter_infra/releases",
"current_release": {
"beta": "3ea4d06340a97a1e9d7cae97567c64e0569dcaa2",
......
......@@ -42,7 +42,8 @@ ProcessId CreationDate CommandLine
});
test('Parse Posix output', () {
const String psOutput = r'''STARTED PID COMMAND
const String psOutput = r'''
STARTED PID COMMAND
Sat Mar 9 20:12:47 2019 1 /sbin/launchd
Sat Mar 9 20:13:00 2019 49 /usr/sbin/syslogd
''';
......
......@@ -274,7 +274,8 @@ void createFooter(String footerPath, String version) {
File('${footerPath}footer.html').writeAsStringSync('<script src="footer.js"></script>');
File('$kPublishRoot/api/footer.js')
..createSync(recursive: true)
..writeAsStringSync('''(function() {
..writeAsStringSync('''
(function() {
var span = document.querySelector('footer>span');
if (span) {
span.innerText = 'Flutter $version $timestamp ${gitRevision()} $gitBranchOut';
......
......@@ -18,7 +18,8 @@ final String defaultArbPathString = path.join('lib', 'l10n');
const String defaultTemplateArbFileName = 'app_en_US.arb';
const String defaultOutputFileString = 'output-localization-file';
const String defaultClassNameString = 'AppLocalizations';
const String singleMessageArbFileString = '''{
const String singleMessageArbFileString = '''
{
"title": "Title",
"@title": {
"description": "Title for the application"
......@@ -26,10 +27,12 @@ const String singleMessageArbFileString = '''{
}''';
const String esArbFileName = 'app_es.arb';
const String singleEsMessageArbFileString = '''{
const String singleEsMessageArbFileString = '''
{
"title": "Título"
}''';
const String singleZhMessageArbFileString = '''{
const String singleZhMessageArbFileString = '''
{
"title": "标题"
}''';
......@@ -431,7 +434,8 @@ void main() {
});
test('correctly parses @@locale property in arb file', () {
const String arbFileWithEnLocale = '''{
const String arbFileWithEnLocale = '''
{
"@@locale": "en",
"title": "Title",
"@title": {
......@@ -439,7 +443,8 @@ void main() {
}
}''';
const String arbFileWithZhLocale = '''{
const String arbFileWithZhLocale = '''
{
"@@locale": "zh",
"title": "标题",
"@title": {
......@@ -473,7 +478,8 @@ void main() {
});
test('correctly prioritizes @@locale property in arb file over filename', () {
const String arbFileWithEnLocale = '''{
const String arbFileWithEnLocale = '''
{
"@@locale": "en",
"title": "Stocks",
"@title": {
......@@ -481,7 +487,8 @@ void main() {
}
}''';
const String arbFileWithZhLocale = '''{
const String arbFileWithZhLocale = '''
{
"@@locale": "zh",
"title": "标题",
"@title": {
......@@ -542,7 +549,8 @@ void main() {
);
});
test('throws when the same locale is detected more than once', () {
const String secondMessageArbFileString = '''{
const String secondMessageArbFileString = '''
{
"market": "MARKET",
"@market": {
"description": "Label for the Market tab"
......@@ -580,7 +588,8 @@ void main() {
group('generateClassMethods', () {
group('DateTime tests', () {
test('throws an exception when improperly formatted date is passed in', () {
const String singleDateMessageArbFileString = '''{
const String singleDateMessageArbFileString = '''
{
"springBegins": "Spring begins on {springStartDate}",
"@springBegins": {
"description": "The first day of spring",
......@@ -618,7 +627,8 @@ void main() {
});
test('throws an exception when no format attribute is passed in', () {
const String singleDateMessageArbFileString = '''{
const String singleDateMessageArbFileString = '''
{
"springBegins": "Spring begins on {springStartDate}",
"@springBegins": {
"description": "The first day of spring",
......@@ -653,7 +663,8 @@ void main() {
});
test('correctly generates simple message with date along with other placeholders', () {
const String singleDateMessageArbFileString = '''{
const String singleDateMessageArbFileString = '''
{
"springGreetings": "Since it's {springStartDate}, it's finally spring! {helloWorld}!",
"@springGreetings": {
"description": "A realization that it's finally the spring season, followed by a greeting.",
......@@ -721,7 +732,8 @@ void main() {
};
for (final String numberFormat in numberFormatsWithNamedParameters) {
final String singleNumberMessage = '''{
final String singleNumberMessage = '''
{
"courseCompletion": "You have completed {progress} of the course.",
"@courseCompletion": {
"description": "The amount of progress the student has made in their class.",
......@@ -788,7 +800,8 @@ void main() {
};
for (final String numberFormat in numberFormatsWithPositionalParameters) {
final String singleNumberMessage = '''{
final String singleNumberMessage = '''
{
"courseCompletion": "You have completed {progress} of the course.",
"@courseCompletion": {
"description": "The amount of progress the student has made in their class.",
......@@ -843,7 +856,8 @@ void main() {
});
test('throws an exception when improperly formatted number is passed in', () {
const String singleDateMessageArbFileString = '''{
const String singleDateMessageArbFileString = '''
{
"courseCompletion": "You have completed {progress} of the course.",
"@courseCompletion": {
"description": "The amount of progress the student has made in their class.",
......@@ -883,7 +897,8 @@ void main() {
group('plural messages', () {
test('should throw attempting to generate a plural message without placeholders', () {
const String pluralMessageWithoutPlaceholdersAttribute = '''{
const String pluralMessageWithoutPlaceholdersAttribute = '''
{
"helloWorlds": "{count,plural, =0{Hello}=1{Hello World}=2{Hello two worlds}few{Hello {count} worlds}many{Hello all {count} worlds}other{Hello other {count} worlds}}",
"@helloWorlds": {
"description": "Improperly formatted since it has no placeholder attribute."
......@@ -913,7 +928,8 @@ void main() {
});
test('should throw attempting to generate a plural message with an empty placeholders map', () {
const String pluralMessageWithEmptyPlaceholdersMap = '''{
const String pluralMessageWithEmptyPlaceholdersMap = '''
{
"helloWorlds": "{count,plural, =0{Hello}=1{Hello World}=2{Hello two worlds}few{Hello {count} worlds}many{Hello all {count} worlds}other{Hello other {count} worlds}}",
"@helloWorlds": {
"description": "Improperly formatted since it has no placeholder attribute.",
......@@ -944,7 +960,8 @@ void main() {
});
test('should throw attempting to generate a plural message with no resource attributes', () {
const String pluralMessageWithoutResourceAttributes = '''{
const String pluralMessageWithoutResourceAttributes = '''
{
"helloWorlds": "{count,plural, =0{Hello}=1{Hello World}=2{Hello two worlds}few{Hello {count} worlds}many{Hello all {count} worlds}other{Hello other {count} worlds}}"
}''';
......@@ -971,7 +988,8 @@ void main() {
});
test('should throw attempting to generate a plural message with incorrect format for placeholders', () {
const String pluralMessageWithIncorrectPlaceholderFormat = '''{
const String pluralMessageWithIncorrectPlaceholderFormat = '''
{
"helloWorlds": "{count,plural, =0{Hello}=1{Hello World}=2{Hello two worlds}few{Hello {count} worlds}many{Hello all {count} worlds}other{Hello other {count} worlds}}",
"@helloWorlds": {
"placeholders": "Incorrectly a string, should be a map."
......@@ -1003,7 +1021,8 @@ void main() {
});
test('should throw when failing to parse the arb file', () {
const String arbFileWithTrailingComma = '''{
const String arbFileWithTrailingComma = '''
{
"title": "Stocks",
"@title": {
"description": "Title for the Stocks application"
......@@ -1036,7 +1055,8 @@ void main() {
});
test('should throw when resource is missing resource attribute', () {
const String arbFileWithMissingResourceAttribute = '''{
const String arbFileWithMissingResourceAttribute = '''
{
"title": "Stocks"
}''';
final Directory l10nDirectory = fs.currentDirectory.childDirectory('lib').childDirectory('l10n')
......@@ -1067,7 +1087,8 @@ void main() {
group('checks for method/getter formatting', () {
test('cannot contain non-alphanumeric symbols', () {
const String nonAlphaNumericArbFile = '''{
const String nonAlphaNumericArbFile = '''
{
"title!!": "Stocks",
"@title!!": {
"description": "Title for the Stocks application"
......@@ -1097,7 +1118,8 @@ void main() {
});
test('must start with lowercase character', () {
const String nonAlphaNumericArbFile = '''{
const String nonAlphaNumericArbFile = '''
{
"Title": "Stocks",
"@Title": {
"description": "Title for the Stocks application"
......@@ -1127,7 +1149,8 @@ void main() {
});
test('cannot start with a number', () {
const String nonAlphaNumericArbFile = '''{
const String nonAlphaNumericArbFile = '''
{
"123title": "Stocks",
"@123title": {
"description": "Title for the Stocks application"
......
......@@ -66,21 +66,23 @@ class ShortAppBar extends StatelessWidget {
}
class FruitPage extends StatelessWidget {
static final String paragraph1 = '''Have you ever held a quince? It's strange;
covered in a fuzz somewhere between peach skin and a spider web. And it's
hard as soft lumber. You'd be forgiven for thinking it's veneered Larch-wood.
But inhale the aroma and you'll instantly know you have something wonderful.
Its scent can fill a room for days. And all this before you've even cooked it.
'''.replaceAll('\n', '');
static final String paragraph1 = '''
Have you ever held a quince? It's strange;
covered in a fuzz somewhere between peach skin and a spider web. And it's
hard as soft lumber. You'd be forgiven for thinking it's veneered Larch-wood.
But inhale the aroma and you'll instantly know you have something wonderful.
Its scent can fill a room for days. And all this before you've even cooked it.
'''.replaceAll('\n', ' ');
static final String paragraph2 = '''Pomegranates on the other hand have become
almost ubiquitous. You can find its juice in any bodega, Walmart, and even some
gas stations. But at what cost? The pomegranate juice craze of the aughts made
"megafarmers" Lynda and Stewart Resnick billions. Unfortunately, it takes a lot
of water to make that much pomegranate juice. Water the Resnicks get from their
majority stake in the Kern Water Bank. How did one family come to hold control
over water meant for the whole central valley of California? The story will shock you.
'''.replaceAll('\n', '');
static final String paragraph2 = '''
Pomegranates on the other hand have become
almost ubiquitous. You can find its juice in any bodega, Walmart, and even some
gas stations. But at what cost? The pomegranate juice craze of the aughts made
"megafarmers" Lynda and Stewart Resnick billions. Unfortunately, it takes a lot
of water to make that much pomegranate juice. Water the Resnicks get from their
majority stake in the Kern Water Bank. How did one family come to hold control
over water meant for the whole central valley of California? The story will shock you.
'''.replaceAll('\n', ' ');
@override
Widget build(BuildContext context) {
......
......@@ -24,7 +24,8 @@ void main() {
});
}
const String testCodeFile = '''// A fake test file
const String testCodeFile = '''
// A fake test file
// START test_0
test 0 0
test 0 1
......
......@@ -249,8 +249,8 @@ void main() {
// RegExp matcher is required here due to flutter web and flutter mobile generating
// slightly different floating point numbers
// in Flutter web 0.0 sometimes just appears as 0. or 0
RegExp(
r'''FlutterError
RegExp(r'''
FlutterError
Invalid curve endpoint at \d+(\.\d*)?\.
Curves must map 0\.0 to near zero and 1\.0 to near one but
BogusCurve mapped \d+(\.\d*)? to \d+(\.\d*)?, which is near \d+(\.\d*)?\.
......
......@@ -355,7 +355,8 @@ void main() {
test('Identifies user fault', () {
// User fault because they called `new Text(null)` from their own code.
final StackTrace stack = StackTrace.fromString('''#0 _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:42:39)
final StackTrace stack = StackTrace.fromString('''
#0 _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:42:39)
#1 _AssertionError._throwNew (dart:core-patch/errors_patch.dart:38:5)
#2 new Text (package:flutter/src/widgets/text.dart:287:10)
#3 _MyHomePageState.build (package:hello_flutter/main.dart:72:16)
......@@ -389,7 +390,8 @@ void main() {
test('Identifies our fault', () {
// Our fault because we should either have an assertion in `text_helper.dart`
// or we should make sure not to pass bad values into new Text.
final StackTrace stack = StackTrace.fromString('''#0 _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:42:39)
final StackTrace stack = StackTrace.fromString('''
#0 _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:42:39)
#1 _AssertionError._throwNew (dart:core-patch/errors_patch.dart:38:5)
#2 new Text (package:flutter/src/widgets/text.dart:287:10)
#3 new SomeWidgetUsingText (package:flutter/src/widgets/text_helper.dart:287:10)
......
......@@ -250,8 +250,8 @@ void main() {
// in Flutter web 0.0 sometimes just appears as 0. or 0
expect(
error.toStringDeep(),
matches(RegExp(
r'''FlutterError
matches(RegExp(r'''
FlutterError
ClampingScrollPhysics\.applyBoundaryConditions\(\) was called
redundantly\.
The proposed new position\, 500(\.\d*)?, is exactly equal to the current
......
......@@ -23,11 +23,12 @@ class DriverError extends Error {
String toString() {
if (originalError == null)
return 'DriverError: $message\n';
return '''DriverError: $message
return '''
DriverError: $message
Original error: $originalError
Original stack trace:
$originalStackTrace
''';
''';
}
}
......
......@@ -489,7 +489,8 @@ String _readFileContent(File file) {
return file.existsSync() ? file.readAsStringSync() : null;
}
const String _androidPluginRegistryTemplateOldEmbedding = '''package io.flutter.plugins;
const String _androidPluginRegistryTemplateOldEmbedding = '''
package io.flutter.plugins;
import io.flutter.plugin.common.PluginRegistry;
{{#plugins}}
......@@ -520,7 +521,8 @@ public final class GeneratedPluginRegistrant {
}
''';
const String _androidPluginRegistryTemplateNewEmbedding = '''package io.flutter.plugins;
const String _androidPluginRegistryTemplateNewEmbedding = '''
package io.flutter.plugins;
{{#androidX}}
import androidx.annotation.Keep;
......@@ -646,7 +648,8 @@ Future<void> _writeAndroidPluginRegistrant(FlutterProject project, List<Plugin>
);
}
const String _objcPluginRegistryHeaderTemplate = '''//
const String _objcPluginRegistryHeaderTemplate = '''
//
// Generated file. Do not edit.
//
......@@ -665,7 +668,8 @@ NS_ASSUME_NONNULL_END
#endif /* GeneratedPluginRegistrant_h */
''';
const String _objcPluginRegistryImplementationTemplate = '''//
const String _objcPluginRegistryImplementationTemplate = '''
//
// Generated file. Do not edit.
//
......@@ -690,7 +694,8 @@ const String _objcPluginRegistryImplementationTemplate = '''//
@end
''';
const String _swiftPluginRegistryTemplate = '''//
const String _swiftPluginRegistryTemplate = '''
//
// Generated file. Do not edit.
//
......@@ -736,7 +741,8 @@ Depends on all your plugins, and provides a function to register them.
end
''';
const String _dartPluginRegistryTemplate = '''//
const String _dartPluginRegistryTemplate = '''
//
// Generated file. Do not edit.
//
......@@ -757,7 +763,8 @@ void registerPlugins(PluginRegistry registry) {
}
''';
const String _cppPluginRegistryHeaderTemplate = '''//
const String _cppPluginRegistryHeaderTemplate = '''
//
// Generated file. Do not edit.
//
......@@ -772,7 +779,8 @@ void RegisterPlugins(flutter::PluginRegistry* registry);
#endif // GENERATED_PLUGIN_REGISTRANT_
''';
const String _cppPluginRegistryImplementationTemplate = '''//
const String _cppPluginRegistryImplementationTemplate = '''
//
// Generated file. Do not edit.
//
......
......@@ -40,7 +40,8 @@ class GitHubTemplateCreator {
String doctorText
) async {
final String title = '[tool_crash] $errorString';
final String body = '''## Command
final String body = '''
## Command
```
$command
```
......
......@@ -41,7 +41,8 @@ void main() {
} else {
flutterRootUri.write(canonicalizedFlutterRootPath);
}
final String dotPackagesSrc = '''# Generated
final String dotPackagesSrc = '''
# Generated
flutter:$flutterRootUri/packages/flutter/lib/
sky_engine:$flutterRootUri/bin/cache/pkg/sky_engine/lib/
flutter_project:lib/
......@@ -357,7 +358,8 @@ class _MyHomePageState extends State<MyHomePage> {
}
''';
const String pubspecYamlSrc = r'''name: flutter_project
const String pubspecYamlSrc = r'''
name: flutter_project
environment:
sdk: ">=2.1.0 <3.0.0"
......
......@@ -35,7 +35,8 @@ final Generator _kNoColorTerminalPlatform = () => FakePlatform.fromPlatform(cons
final Map<Type, Generator> noColorTerminalOverride = <Type, Generator>{
Platform: _kNoColorTerminalPlatform,
};
const String samplesIndexJson = '''[
const String samplesIndexJson = '''
[
{ "id": "sample1" },
{ "id": "sample2" }
]''';
......
......@@ -1669,8 +1669,8 @@ plugin1=${plugin1.path}
fileSystem.file('out/android_arm/flutter_embedding_release.pom')
..createSync(recursive: true)
..writeAsStringSync(
'''<?xml version="1.0" encoding="UTF-8"?>
..writeAsStringSync('''
<?xml version="1.0" encoding="UTF-8"?>
<project>
<version>1.0.0-73fd6b049a80bcea2db1f26c7cee434907cd188b</version>
<dependencies>
......@@ -1761,8 +1761,8 @@ plugin1=${plugin1.path}
fileSystem.file('out/android_arm/flutter_embedding_release.pom')
..createSync(recursive: true)
..writeAsStringSync(
'''<?xml version="1.0" encoding="UTF-8"?>
..writeAsStringSync('''
<?xml version="1.0" encoding="UTF-8"?>
<project>
<version>1.0.0-73fd6b049a80bcea2db1f26c7cee434907cd188b</version>
<dependencies>
......
......@@ -396,8 +396,8 @@ void main() {
});
}
const String _aaptDataWithExplicitEnabledAndMainLauncherActivity =
'''N: android=http://schemas.android.com/apk/res/android
const String _aaptDataWithExplicitEnabledAndMainLauncherActivity = '''
N: android=http://schemas.android.com/apk/res/android
E: manifest (line=7)
A: android:versionCode(0x0101021b)=(type 0x10)0x1
A: android:versionName(0x0101021c)="0.0.1" (Raw: "0.0.1")
......@@ -437,8 +437,8 @@ const String _aaptDataWithExplicitEnabledAndMainLauncherActivity =
A: android:name(0x01010003)="android.intent.category.LAUNCHER" (Raw: "android.intent.category.LAUNCHER")''';
const String _aaptDataWithDefaultEnabledAndMainLauncherActivity =
'''N: android=http://schemas.android.com/apk/res/android
const String _aaptDataWithDefaultEnabledAndMainLauncherActivity = '''
N: android=http://schemas.android.com/apk/res/android
E: manifest (line=7)
A: android:versionCode(0x0101021b)=(type 0x10)0x1
A: android:versionName(0x0101021c)="0.0.1" (Raw: "0.0.1")
......@@ -477,8 +477,8 @@ const String _aaptDataWithDefaultEnabledAndMainLauncherActivity =
A: android:name(0x01010003)="android.intent.category.LAUNCHER" (Raw: "android.intent.category.LAUNCHER")''';
const String _aaptDataWithNoEnabledActivity =
'''N: android=http://schemas.android.com/apk/res/android
const String _aaptDataWithNoEnabledActivity = '''
N: android=http://schemas.android.com/apk/res/android
E: manifest (line=7)
A: android:versionCode(0x0101021b)=(type 0x10)0x1
A: android:versionName(0x0101021c)="0.0.1" (Raw: "0.0.1")
......@@ -507,8 +507,8 @@ const String _aaptDataWithNoEnabledActivity =
E: category (line=45)
A: android:name(0x01010003)="android.intent.category.LAUNCHER" (Raw: "android.intent.category.LAUNCHER")''';
const String _aaptDataWithNoMainActivity =
'''N: android=http://schemas.android.com/apk/res/android
const String _aaptDataWithNoMainActivity = '''
N: android=http://schemas.android.com/apk/res/android
E: manifest (line=7)
A: android:versionCode(0x0101021b)=(type 0x10)0x1
A: android:versionName(0x0101021c)="0.0.1" (Raw: "0.0.1")
......@@ -535,8 +535,8 @@ const String _aaptDataWithNoMainActivity =
E: category (line=43)
A: android:name(0x01010003)="android.intent.category.LAUNCHER" (Raw: "android.intent.category.LAUNCHER")''';
const String _aaptDataWithNoLauncherActivity =
'''N: android=http://schemas.android.com/apk/res/android
const String _aaptDataWithNoLauncherActivity = '''
N: android=http://schemas.android.com/apk/res/android
E: manifest (line=7)
A: android:versionCode(0x0101021b)=(type 0x10)0x1
A: android:versionName(0x0101021c)="0.0.1" (Raw: "0.0.1")
......@@ -563,8 +563,8 @@ const String _aaptDataWithNoLauncherActivity =
E: action (line=43)
A: android:name(0x01010003)="android.intent.action.MAIN" (Raw: "android.intent.action.MAIN")''';
const String _aaptDataWithLauncherAndDefaultActivity =
'''N: android=http://schemas.android.com/apk/res/android
const String _aaptDataWithLauncherAndDefaultActivity = '''
N: android=http://schemas.android.com/apk/res/android
N: dist=http://schemas.android.com/apk/distribution
E: manifest (line=7)
A: android:versionCode(0x0101021b)=(type 0x10)0x1
......@@ -601,8 +601,8 @@ const String _aaptDataWithLauncherAndDefaultActivity =
A: android:name(0x01010003)="android.intent.category.LAUNCHER" (Raw: "android.intent.category.LAUNCHER")
''';
const String _aaptDataWithDistNamespace =
'''N: android=http://schemas.android.com/apk/res/android
const String _aaptDataWithDistNamespace = '''
N: android=http://schemas.android.com/apk/res/android
N: dist=http://schemas.android.com/apk/distribution
E: manifest (line=7)
A: android:versionCode(0x0101021b)=(type 0x10)0x1
......
......@@ -107,7 +107,8 @@ device_info=/fake/pub.dartlang.org/pub.dartlang.org/device_info-0.4.1+4/
final String actualURL = await creator.toolCrashIssueTemplateGitHubURL(command, errorString, exception, stackTrace, doctorText);
final String actualBody = Uri.parse(actualURL).queryParameters['body'];
const String expectedBody = '''## Command
const String expectedBody = '''
## Command
```
flutter test
```
......
......@@ -79,7 +79,8 @@ void main() {
const String addr = '192.168.1.1';
runner = SshCommandRunner.withProcessManager(mockProcessManager,
address: addr);
when<dynamic>(mockProcessResult.stdout).thenReturn('''this
when<dynamic>(mockProcessResult.stdout).thenReturn('''
this
has
four
lines''');
......
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