Unverified Commit 25c10d6a authored by Jenn Magder's avatar Jenn Magder Committed by GitHub

Replace testUsingContext with testWithoutContext in a few places (#82498)

parent c533ab65
...@@ -22,7 +22,7 @@ import 'package:meta/meta.dart'; ...@@ -22,7 +22,7 @@ import 'package:meta/meta.dart';
import 'package:test/fake.dart'; import 'package:test/fake.dart';
import '../src/common.dart'; import '../src/common.dart';
import '../src/context.dart'; import '../src/fake_process_manager.dart';
void main() { void main() {
group('Basic info', () { group('Basic info', () {
...@@ -244,7 +244,7 @@ void main() { ...@@ -244,7 +244,7 @@ void main() {
expect(portForwarder.forwardedPorts.isEmpty, true); expect(portForwarder.forwardedPorts.isEmpty, true);
}); });
testUsingContext('createDevFSWriter returns a LocalDevFSWriter', () { testWithoutContext('createDevFSWriter returns a LocalDevFSWriter', () {
final FakeDesktopDevice device = setUpDesktopDevice(); final FakeDesktopDevice device = setUpDesktopDevice();
expect(device.createDevFSWriter(null, ''), isA<LocalDevFSWriter>()); expect(device.createDevFSWriter(null, ''), isA<LocalDevFSWriter>());
......
...@@ -2,24 +2,21 @@ ...@@ -2,24 +2,21 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'dart:io' as io; // ignore: dart_io_import import 'dart:io' as io; // ignore: dart_io_import
import 'package:flutter_tools/src/base/io.dart'; import 'package:flutter_tools/src/base/io.dart';
import 'package:flutter_tools/src/device_port_forwarder.dart'; import 'package:flutter_tools/src/device_port_forwarder.dart';
import 'package:test/fake.dart'; import 'package:test/fake.dart';
import '../src/common.dart'; import '../src/common.dart';
import '../src/context.dart';
void main() { void main() {
testUsingContext('dispose does not throw exception if no process is present', () { testWithoutContext('dispose does not throw exception if no process is present', () {
final ForwardedPort forwardedPort = ForwardedPort(123, 456); final ForwardedPort forwardedPort = ForwardedPort(123, 456);
expect(forwardedPort.context, isNull); expect(forwardedPort.context, isNull);
forwardedPort.dispose(); forwardedPort.dispose();
}); });
testUsingContext('dispose kills process if process was available', () { testWithoutContext('dispose kills process if process was available', () {
final FakeProcess process = FakeProcess(); final FakeProcess process = FakeProcess();
final ForwardedPort forwardedPort = ForwardedPort.withContext(123, 456, process); final ForwardedPort forwardedPort = ForwardedPort.withContext(123, 456, process);
forwardedPort.dispose(); forwardedPort.dispose();
......
...@@ -2,8 +2,6 @@ ...@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// @dart = 2.8
import 'package:file/memory.dart'; import 'package:file/memory.dart';
import 'package:flutter_tools/src/base/file_system.dart'; import 'package:flutter_tools/src/base/file_system.dart';
import 'package:flutter_tools/src/base/logger.dart'; import 'package:flutter_tools/src/base/logger.dart';
...@@ -14,7 +12,6 @@ import 'package:flutter_tools/src/localizations/localizations_utils.dart'; ...@@ -14,7 +12,6 @@ import 'package:flutter_tools/src/localizations/localizations_utils.dart';
import 'package:yaml/yaml.dart'; import 'package:yaml/yaml.dart';
import '../src/common.dart'; import '../src/common.dart';
import '../src/context.dart';
const String defaultTemplateArbFileName = 'app_en.arb'; const String defaultTemplateArbFileName = 'app_en.arb';
const String defaultOutputFileString = 'output-localization-file.dart'; const String defaultOutputFileString = 'output-localization-file.dart';
...@@ -68,10 +65,10 @@ void _standardFlutterDirectoryL10nSetup(FileSystem fs) { ...@@ -68,10 +65,10 @@ void _standardFlutterDirectoryL10nSetup(FileSystem fs) {
} }
void main() { void main() {
MemoryFileSystem fs; late MemoryFileSystem fs;
String defaultL10nPathString; late String defaultL10nPathString;
String syntheticPackagePath; late String syntheticPackagePath;
String syntheticL10nPackagePath; late String syntheticL10nPackagePath;
setUp(() { setUp(() {
fs = MemoryFileSystem.test(); fs = MemoryFileSystem.test();
...@@ -112,7 +109,7 @@ void main() { ...@@ -112,7 +109,7 @@ void main() {
); );
}); });
testUsingContext('sets absolute path of the target Flutter project', () { testWithoutContext('sets absolute path of the target Flutter project', () {
// Set up project directory. // Set up project directory.
final Directory l10nDirectory = fs.currentDirectory final Directory l10nDirectory = fs.currentDirectory
.childDirectory('absolute') .childDirectory('absolute')
...@@ -262,7 +259,7 @@ void main() { ...@@ -262,7 +259,7 @@ void main() {
}); });
}); });
testUsingContext('correctly adds a headerString when it is set', () { testWithoutContext('correctly adds a headerString when it is set', () {
_standardFlutterDirectoryL10nSetup(fs); _standardFlutterDirectoryL10nSetup(fs);
LocalizationsGenerator generator; LocalizationsGenerator generator;
...@@ -283,7 +280,7 @@ void main() { ...@@ -283,7 +280,7 @@ void main() {
expect(generator.header, '/// Sample header'); expect(generator.header, '/// Sample header');
}); });
testUsingContext('correctly adds a headerFile when it is set', () { testWithoutContext('correctly adds a headerFile when it is set', () {
fs.currentDirectory.childDirectory('lib').childDirectory('l10n') fs.currentDirectory.childDirectory('lib').childDirectory('l10n')
..createSync(recursive: true) ..createSync(recursive: true)
..childFile(defaultTemplateArbFileName).writeAsStringSync(singleMessageArbFileString) ..childFile(defaultTemplateArbFileName).writeAsStringSync(singleMessageArbFileString)
...@@ -308,7 +305,7 @@ void main() { ...@@ -308,7 +305,7 @@ void main() {
expect(generator.header, '/// Sample header in a text file'); expect(generator.header, '/// Sample header in a text file');
}); });
testUsingContext('sets templateArbFileName with more than one underscore correctly', () { testWithoutContext('sets templateArbFileName with more than one underscore correctly', () {
final Directory l10nDirectory = fs.currentDirectory.childDirectory('lib').childDirectory('l10n') final Directory l10nDirectory = fs.currentDirectory.childDirectory('lib').childDirectory('l10n')
..createSync(recursive: true); ..createSync(recursive: true);
l10nDirectory.childFile('app_localizations_en.arb') l10nDirectory.childFile('app_localizations_en.arb')
...@@ -335,7 +332,7 @@ void main() { ...@@ -335,7 +332,7 @@ void main() {
expect(outputDirectory.childFile('output-localization-file_es.dart').existsSync(), isTrue); expect(outputDirectory.childFile('output-localization-file_es.dart').existsSync(), isTrue);
}); });
testUsingContext('filenames with invalid locales should not be recognized', () { testWithoutContext('filenames with invalid locales should not be recognized', () {
final Directory l10nDirectory = fs.currentDirectory.childDirectory('lib').childDirectory('l10n') final Directory l10nDirectory = fs.currentDirectory.childDirectory('lib').childDirectory('l10n')
..createSync(recursive: true); ..createSync(recursive: true);
l10nDirectory.childFile('app_localizations_en.arb') l10nDirectory.childFile('app_localizations_en.arb')
...@@ -358,7 +355,7 @@ void main() { ...@@ -358,7 +355,7 @@ void main() {
fail('Using app_en_CA_foo.arb should fail as it is not a valid locale.'); fail('Using app_en_CA_foo.arb should fail as it is not a valid locale.');
}); });
testUsingContext('correctly creates an untranslated messages file (useSyntheticPackage = true)', () { testWithoutContext('correctly creates an untranslated messages file (useSyntheticPackage = true)', () {
fs.currentDirectory.childDirectory('lib').childDirectory('l10n') fs.currentDirectory.childDirectory('lib').childDirectory('l10n')
..createSync(recursive: true) ..createSync(recursive: true)
..childFile(defaultTemplateArbFileName).writeAsStringSync(twoMessageArbFileString) ..childFile(defaultTemplateArbFileName).writeAsStringSync(twoMessageArbFileString)
...@@ -394,7 +391,7 @@ void main() { ...@@ -394,7 +391,7 @@ void main() {
expect(unimplementedOutputString, contains('subtitle')); expect(unimplementedOutputString, contains('subtitle'));
}); });
testUsingContext('correctly creates an untranslated messages file (useSyntheticPackage = false)', () { testWithoutContext('correctly creates an untranslated messages file (useSyntheticPackage = false)', () {
fs.currentDirectory.childDirectory('lib').childDirectory('l10n') fs.currentDirectory.childDirectory('lib').childDirectory('l10n')
..createSync(recursive: true) ..createSync(recursive: true)
..childFile(defaultTemplateArbFileName).writeAsStringSync(twoMessageArbFileString) ..childFile(defaultTemplateArbFileName).writeAsStringSync(twoMessageArbFileString)
...@@ -431,7 +428,7 @@ void main() { ...@@ -431,7 +428,7 @@ void main() {
expect(unimplementedOutputString, contains('subtitle')); expect(unimplementedOutputString, contains('subtitle'));
}); });
testUsingContext( testWithoutContext(
'untranslated messages suggestion is printed when translation is missing: ' 'untranslated messages suggestion is printed when translation is missing: '
'command line message', 'command line message',
() { () {
...@@ -468,7 +465,7 @@ void main() { ...@@ -468,7 +465,7 @@ void main() {
}, },
); );
testUsingContext( testWithoutContext(
'untranslated messages suggestion is printed when translation is missing: ' 'untranslated messages suggestion is printed when translation is missing: '
'l10n.yaml message', 'l10n.yaml message',
() { () {
...@@ -503,7 +500,7 @@ void main() { ...@@ -503,7 +500,7 @@ void main() {
}, },
); );
testUsingContext( testWithoutContext(
'unimplemented messages suggestion is not printed when all messages ' 'unimplemented messages suggestion is not printed when all messages '
'are fully translated', 'are fully translated',
() { () {
...@@ -532,7 +529,7 @@ void main() { ...@@ -532,7 +529,7 @@ void main() {
}, },
); );
testUsingContext('untranslated messages file included in generated JSON list of outputs', () { testWithoutContext('untranslated messages file included in generated JSON list of outputs', () {
_standardFlutterDirectoryL10nSetup(fs); _standardFlutterDirectoryL10nSetup(fs);
try { try {
...@@ -563,7 +560,7 @@ void main() { ...@@ -563,7 +560,7 @@ void main() {
expect(outputList, contains(contains('unimplemented_message_translations.json'))); expect(outputList, contains(contains('unimplemented_message_translations.json')));
}); });
testUsingContext( testWithoutContext(
'uses inputPathString as outputPathString when the outputPathString is ' 'uses inputPathString as outputPathString when the outputPathString is '
'null while not using the synthetic package option', 'null while not using the synthetic package option',
() { () {
...@@ -591,7 +588,7 @@ void main() { ...@@ -591,7 +588,7 @@ void main() {
}, },
); );
testUsingContext( testWithoutContext(
'correctly generates output files in non-default output directory if it ' 'correctly generates output files in non-default output directory if it '
'already exists while not using the synthetic package option', 'already exists while not using the synthetic package option',
() { () {
...@@ -633,7 +630,7 @@ void main() { ...@@ -633,7 +630,7 @@ void main() {
}, },
); );
testUsingContext( testWithoutContext(
'correctly creates output directory if it does not exist and writes files ' 'correctly creates output directory if it does not exist and writes files '
'in it while not using the synthetic package option', 'in it while not using the synthetic package option',
() { () {
...@@ -663,7 +660,7 @@ void main() { ...@@ -663,7 +660,7 @@ void main() {
}, },
); );
testUsingContext( testWithoutContext(
'generates nullable localizations class getter via static `of` method ' 'generates nullable localizations class getter via static `of` method '
'by default', 'by default',
() { () {
...@@ -699,7 +696,7 @@ void main() { ...@@ -699,7 +696,7 @@ void main() {
}, },
); );
testUsingContext( testWithoutContext(
'can generate non-nullable localizations class getter via static `of` method ', 'can generate non-nullable localizations class getter via static `of` method ',
() { () {
_standardFlutterDirectoryL10nSetup(fs); _standardFlutterDirectoryL10nSetup(fs);
...@@ -735,7 +732,7 @@ void main() { ...@@ -735,7 +732,7 @@ void main() {
}, },
); );
testUsingContext('creates list of inputs and outputs when file path is specified', () { testWithoutContext('creates list of inputs and outputs when file path is specified', () {
_standardFlutterDirectoryL10nSetup(fs); _standardFlutterDirectoryL10nSetup(fs);
try { try {
...@@ -771,7 +768,7 @@ void main() { ...@@ -771,7 +768,7 @@ void main() {
expect(outputList, contains(fs.path.absolute(syntheticL10nPackagePath, 'output-localization-file_es.dart'))); expect(outputList, contains(fs.path.absolute(syntheticL10nPackagePath, 'output-localization-file_es.dart')));
}); });
testUsingContext('setting both a headerString and a headerFile should fail', () { testWithoutContext('setting both a headerString and a headerFile should fail', () {
fs.currentDirectory.childDirectory('lib').childDirectory('l10n') fs.currentDirectory.childDirectory('lib').childDirectory('l10n')
..createSync(recursive: true) ..createSync(recursive: true)
..childFile(defaultTemplateArbFileName).writeAsStringSync(singleMessageArbFileString) ..childFile(defaultTemplateArbFileName).writeAsStringSync(singleMessageArbFileString)
...@@ -797,7 +794,7 @@ void main() { ...@@ -797,7 +794,7 @@ void main() {
fail('Setting both headerFile and headerString should fail'); fail('Setting both headerFile and headerString should fail');
}); });
testUsingContext('setting a headerFile that does not exist should fail', () { testWithoutContext('setting a headerFile that does not exist should fail', () {
final Directory l10nDirectory = fs.currentDirectory.childDirectory('lib').childDirectory('l10n') final Directory l10nDirectory = fs.currentDirectory.childDirectory('lib').childDirectory('l10n')
..createSync(recursive: true); ..createSync(recursive: true);
l10nDirectory.childFile(defaultTemplateArbFileName) l10nDirectory.childFile(defaultTemplateArbFileName)
...@@ -860,11 +857,11 @@ void main() { ...@@ -860,11 +857,11 @@ void main() {
expect(generator.preferredSupportedLocales.single, LocaleInfo.fromString('es')); expect(generator.preferredSupportedLocales.single, LocaleInfo.fromString('es'));
expect(generator.header, 'HEADER'); expect(generator.header, 'HEADER');
expect(generator.useDeferredLoading, isTrue); expect(generator.useDeferredLoading, isTrue);
expect(generator.inputsAndOutputsListFile.path, '/gen_l10n_inputs_and_outputs.json'); expect(generator.inputsAndOutputsListFile?.path, '/gen_l10n_inputs_and_outputs.json');
expect(generator.useSyntheticPackage, isFalse); expect(generator.useSyntheticPackage, isFalse);
expect(generator.projectDirectory.path, '/'); expect(generator.projectDirectory?.path, '/');
expect(generator.areResourceAttributesRequired, isTrue); expect(generator.areResourceAttributesRequired, isTrue);
expect(generator.untranslatedMessagesFile.path, 'untranslated'); expect(generator.untranslatedMessagesFile?.path, 'untranslated');
expect(generator.usesNullableGetter, isFalse); expect(generator.usesNullableGetter, isFalse);
// Just validate one file. // Just validate one file.
...@@ -926,7 +923,7 @@ flutter: ...@@ -926,7 +923,7 @@ flutter:
}); });
group('loadResources', () { group('loadResources', () {
testUsingContext('correctly initializes supportedLocales and supportedLanguageCodes properties', () { testWithoutContext('correctly initializes supportedLocales and supportedLanguageCodes properties', () {
_standardFlutterDirectoryL10nSetup(fs); _standardFlutterDirectoryL10nSetup(fs);
LocalizationsGenerator generator; LocalizationsGenerator generator;
...@@ -947,7 +944,7 @@ flutter: ...@@ -947,7 +944,7 @@ flutter:
expect(generator.supportedLocales.contains(LocaleInfo.fromString('es')), true); expect(generator.supportedLocales.contains(LocaleInfo.fromString('es')), true);
}); });
testUsingContext('correctly sorts supportedLocales and supportedLanguageCodes alphabetically', () { testWithoutContext('correctly sorts supportedLocales and supportedLanguageCodes alphabetically', () {
final Directory l10nDirectory = fs.currentDirectory.childDirectory('lib').childDirectory('l10n') final Directory l10nDirectory = fs.currentDirectory.childDirectory('lib').childDirectory('l10n')
..createSync(recursive: true); ..createSync(recursive: true);
// Write files in non-alphabetical order so that read performs in that order // Write files in non-alphabetical order so that read performs in that order
...@@ -978,7 +975,7 @@ flutter: ...@@ -978,7 +975,7 @@ flutter:
expect(generator.supportedLocales.elementAt(2), LocaleInfo.fromString('zh')); expect(generator.supportedLocales.elementAt(2), LocaleInfo.fromString('zh'));
}); });
testUsingContext('adds preferred locales to the top of supportedLocales and supportedLanguageCodes', () { testWithoutContext('adds preferred locales to the top of supportedLocales and supportedLanguageCodes', () {
final Directory l10nDirectory = fs.currentDirectory.childDirectory('lib').childDirectory('l10n') final Directory l10nDirectory = fs.currentDirectory.childDirectory('lib').childDirectory('l10n')
..createSync(recursive: true); ..createSync(recursive: true);
l10nDirectory.childFile('app_en.arb') l10nDirectory.childFile('app_en.arb')
...@@ -1010,7 +1007,7 @@ flutter: ...@@ -1010,7 +1007,7 @@ flutter:
expect(generator.supportedLocales.elementAt(2), LocaleInfo.fromString('en')); expect(generator.supportedLocales.elementAt(2), LocaleInfo.fromString('en'));
}); });
testUsingContext( testWithoutContext(
'throws an error attempting to add preferred locales ' 'throws an error attempting to add preferred locales '
'when there is no corresponding arb file for that ' 'when there is no corresponding arb file for that '
'locale', 'locale',
...@@ -1050,7 +1047,7 @@ flutter: ...@@ -1050,7 +1047,7 @@ flutter:
}, },
); );
testUsingContext('correctly sorts arbPathString alphabetically', () { testWithoutContext('correctly sorts arbPathString alphabetically', () {
final Directory l10nDirectory = fs.currentDirectory.childDirectory('lib').childDirectory('l10n') final Directory l10nDirectory = fs.currentDirectory.childDirectory('lib').childDirectory('l10n')
..createSync(recursive: true); ..createSync(recursive: true);
// Write files in non-alphabetical order so that read performs in that order // Write files in non-alphabetical order so that read performs in that order
...@@ -1081,7 +1078,7 @@ flutter: ...@@ -1081,7 +1078,7 @@ flutter:
expect(generator.arbPathStrings.elementAt(2), fs.path.join('lib', 'l10n', 'app_zh.arb')); expect(generator.arbPathStrings.elementAt(2), fs.path.join('lib', 'l10n', 'app_zh.arb'));
}); });
testUsingContext('correctly parses @@locale property in arb file', () { testWithoutContext('correctly parses @@locale property in arb file', () {
const String arbFileWithEnLocale = ''' const String arbFileWithEnLocale = '''
{ {
"@@locale": "en", "@@locale": "en",
...@@ -1126,7 +1123,7 @@ flutter: ...@@ -1126,7 +1123,7 @@ flutter:
expect(generator.supportedLocales.contains(LocaleInfo.fromString('zh')), true); expect(generator.supportedLocales.contains(LocaleInfo.fromString('zh')), true);
}); });
testUsingContext('correctly requires @@locale property in arb file to match the filename locale suffix', () { testWithoutContext('correctly requires @@locale property in arb file to match the filename locale suffix', () {
const String arbFileWithEnLocale = ''' const String arbFileWithEnLocale = '''
{ {
"@@locale": "en", "@@locale": "en",
...@@ -1174,7 +1171,7 @@ flutter: ...@@ -1174,7 +1171,7 @@ flutter:
); );
}); });
testUsingContext("throws when arb file's locale could not be determined", () { testWithoutContext("throws when arb file's locale could not be determined", () {
fs.currentDirectory.childDirectory('lib').childDirectory('l10n') fs.currentDirectory.childDirectory('lib').childDirectory('l10n')
..createSync(recursive: true) ..createSync(recursive: true)
..childFile('app.arb') ..childFile('app.arb')
...@@ -1198,7 +1195,7 @@ flutter: ...@@ -1198,7 +1195,7 @@ flutter:
'should fail' 'should fail'
); );
}); });
testUsingContext('throws when the same locale is detected more than once', () { testWithoutContext('throws when the same locale is detected more than once', () {
const String secondMessageArbFileString = ''' const String secondMessageArbFileString = '''
{ {
"market": "MARKET", "market": "MARKET",
...@@ -1234,7 +1231,7 @@ flutter: ...@@ -1234,7 +1231,7 @@ flutter:
); );
}); });
testUsingContext('throws when the base locale does not exist', () { testWithoutContext('throws when the base locale does not exist', () {
final Directory l10nDirectory = fs.currentDirectory.childDirectory('lib').childDirectory('l10n') final Directory l10nDirectory = fs.currentDirectory.childDirectory('lib').childDirectory('l10n')
..createSync(recursive: true); ..createSync(recursive: true);
l10nDirectory.childFile('app_en_US.arb') l10nDirectory.childFile('app_en_US.arb')
...@@ -1262,7 +1259,7 @@ flutter: ...@@ -1262,7 +1259,7 @@ flutter:
}); });
group('writeOutputFiles', () { group('writeOutputFiles', () {
testUsingContext('message without placeholders - should generate code comment with description and template message translation', () { testWithoutContext('message without placeholders - should generate code comment with description and template message translation', () {
_standardFlutterDirectoryL10nSetup(fs); _standardFlutterDirectoryL10nSetup(fs);
final BufferLogger testLogger = BufferLogger.test(); final BufferLogger testLogger = BufferLogger.test();
try { try {
...@@ -1294,7 +1291,7 @@ flutter: ...@@ -1294,7 +1291,7 @@ flutter:
/// **'Title'**''')); /// **'Title'**'''));
}); });
testUsingContext('template message translation handles newline characters', () { testWithoutContext('template message translation handles newline characters', () {
final Directory l10nDirectory = fs.currentDirectory.childDirectory('lib').childDirectory('l10n') final Directory l10nDirectory = fs.currentDirectory.childDirectory('lib').childDirectory('l10n')
..createSync(recursive: true); ..createSync(recursive: true);
l10nDirectory.childFile(defaultTemplateArbFileName) l10nDirectory.childFile(defaultTemplateArbFileName)
...@@ -1339,7 +1336,7 @@ flutter: ...@@ -1339,7 +1336,7 @@ flutter:
/// **'Title \n of the application'**''')); /// **'Title \n of the application'**'''));
}); });
testUsingContext('message with placeholders - should generate code comment with description and template message translation', () { testWithoutContext('message with placeholders - should generate code comment with description and template message translation', () {
final Directory l10nDirectory = fs.currentDirectory.childDirectory('lib').childDirectory('l10n') final Directory l10nDirectory = fs.currentDirectory.childDirectory('lib').childDirectory('l10n')
..createSync(recursive: true); ..createSync(recursive: true);
l10nDirectory.childFile(defaultTemplateArbFileName) l10nDirectory.childFile(defaultTemplateArbFileName)
...@@ -1394,7 +1391,7 @@ flutter: ...@@ -1394,7 +1391,7 @@ flutter:
/// **'The price of this item is: \${price}'**''')); /// **'The price of this item is: \${price}'**'''));
}); });
testUsingContext('should generate a file per language', () { testWithoutContext('should generate a file per language', () {
const String singleEnCaMessageArbFileString = ''' const String singleEnCaMessageArbFileString = '''
{ {
"title": "Canadian Title" "title": "Canadian Title"
...@@ -1428,7 +1425,7 @@ flutter: ...@@ -1428,7 +1425,7 @@ flutter:
expect(englishLocalizationsFile, contains('class AppLocalizationsEn extends AppLocalizations')); expect(englishLocalizationsFile, contains('class AppLocalizationsEn extends AppLocalizations'));
}); });
testUsingContext('language imports are sorted when preferredSupportedLocaleString is given', () { testWithoutContext('language imports are sorted when preferredSupportedLocaleString is given', () {
fs.currentDirectory.childDirectory('lib').childDirectory('l10n')..createSync(recursive: true) fs.currentDirectory.childDirectory('lib').childDirectory('l10n')..createSync(recursive: true)
..childFile(defaultTemplateArbFileName).writeAsStringSync(singleMessageArbFileString) ..childFile(defaultTemplateArbFileName).writeAsStringSync(singleMessageArbFileString)
..childFile('app_zh.arb').writeAsStringSync(singleZhMessageArbFileString) ..childFile('app_zh.arb').writeAsStringSync(singleZhMessageArbFileString)
...@@ -1462,7 +1459,7 @@ import 'output-localization-file_zh.dart'; ...@@ -1462,7 +1459,7 @@ import 'output-localization-file_zh.dart';
''')); '''));
}); });
testUsingContext('imports are deferred and loaded when useDeferredImports are set', () { testWithoutContext('imports are deferred and loaded when useDeferredImports are set', () {
fs.currentDirectory.childDirectory('lib').childDirectory('l10n')..createSync(recursive: true) fs.currentDirectory.childDirectory('lib').childDirectory('l10n')..createSync(recursive: true)
..childFile(defaultTemplateArbFileName).writeAsStringSync(singleMessageArbFileString); ..childFile(defaultTemplateArbFileName).writeAsStringSync(singleMessageArbFileString);
...@@ -1492,7 +1489,7 @@ import 'output-localization-file_en.dart' deferred as output-localization-file_e ...@@ -1492,7 +1489,7 @@ import 'output-localization-file_en.dart' deferred as output-localization-file_e
}); });
group('DateTime tests', () { group('DateTime tests', () {
testUsingContext('throws an exception when improperly formatted date is passed in', () { testWithoutContext('throws an exception when improperly formatted date is passed in', () {
const String singleDateMessageArbFileString = ''' const String singleDateMessageArbFileString = '''
{ {
"@@locale": "en", "@@locale": "en",
...@@ -1532,7 +1529,7 @@ import 'output-localization-file_en.dart' deferred as output-localization-file_e ...@@ -1532,7 +1529,7 @@ import 'output-localization-file_en.dart' deferred as output-localization-file_e
fail('Improper date formatting should throw an exception'); fail('Improper date formatting should throw an exception');
}); });
testUsingContext('throws an exception when no format attribute is passed in', () { testWithoutContext('throws an exception when no format attribute is passed in', () {
const String singleDateMessageArbFileString = ''' const String singleDateMessageArbFileString = '''
{ {
"springBegins": "Spring begins on {springStartDate}", "springBegins": "Spring begins on {springStartDate}",
...@@ -1569,7 +1566,7 @@ import 'output-localization-file_en.dart' deferred as output-localization-file_e ...@@ -1569,7 +1566,7 @@ import 'output-localization-file_en.dart' deferred as output-localization-file_e
fail('Improper date formatting should throw an exception'); fail('Improper date formatting should throw an exception');
}); });
testUsingContext('throws an exception when improperly formatted number is passed in', () { testWithoutContext('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": "You have completed {progress} of the course.",
...@@ -1611,7 +1608,7 @@ import 'output-localization-file_en.dart' deferred as output-localization-file_e ...@@ -1611,7 +1608,7 @@ import 'output-localization-file_en.dart' deferred as output-localization-file_e
}); });
group('plural messages', () { group('plural messages', () {
testUsingContext('should throw attempting to generate a plural message without placeholders', () { testWithoutContext('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": "{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}}",
...@@ -1643,7 +1640,7 @@ import 'output-localization-file_en.dart' deferred as output-localization-file_e ...@@ -1643,7 +1640,7 @@ import 'output-localization-file_en.dart' deferred as output-localization-file_e
fail('Generating class methods without placeholders should not succeed'); fail('Generating class methods without placeholders should not succeed');
}); });
testUsingContext('should throw attempting to generate a plural message with an empty placeholders map', () { testWithoutContext('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": "{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}}",
...@@ -1676,7 +1673,7 @@ import 'output-localization-file_en.dart' deferred as output-localization-file_e ...@@ -1676,7 +1673,7 @@ import 'output-localization-file_en.dart' deferred as output-localization-file_e
fail('Generating class methods without placeholders should not succeed'); fail('Generating class methods without placeholders should not succeed');
}); });
testUsingContext('should throw attempting to generate a plural message with no resource attributes', () { testWithoutContext('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}}" "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}}"
...@@ -1705,7 +1702,7 @@ import 'output-localization-file_en.dart' deferred as output-localization-file_e ...@@ -1705,7 +1702,7 @@ import 'output-localization-file_en.dart' deferred as output-localization-file_e
fail('Generating plural class method without resource attributes should not succeed'); fail('Generating plural class method without resource attributes should not succeed');
}); });
testUsingContext('should throw attempting to generate a plural message with incorrect format for placeholders', () { testWithoutContext('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": "{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}}",
...@@ -1739,7 +1736,7 @@ import 'output-localization-file_en.dart' deferred as output-localization-file_e ...@@ -1739,7 +1736,7 @@ import 'output-localization-file_en.dart' deferred as output-localization-file_e
}); });
}); });
testUsingContext('intl package import should be omitted in subclass files when no plurals are included', () { testWithoutContext('intl package import should be omitted in subclass files when no plurals are included', () {
fs.currentDirectory.childDirectory('lib').childDirectory('l10n')..createSync(recursive: true) fs.currentDirectory.childDirectory('lib').childDirectory('l10n')..createSync(recursive: true)
..childFile(defaultTemplateArbFileName).writeAsStringSync(singleMessageArbFileString) ..childFile(defaultTemplateArbFileName).writeAsStringSync(singleMessageArbFileString)
..childFile('app_es.arb').writeAsStringSync(singleEsMessageArbFileString); ..childFile('app_es.arb').writeAsStringSync(singleEsMessageArbFileString);
...@@ -1765,7 +1762,7 @@ import 'output-localization-file_en.dart' deferred as output-localization-file_e ...@@ -1765,7 +1762,7 @@ import 'output-localization-file_en.dart' deferred as output-localization-file_e
expect(localizationsFile, isNot(contains(intlImportDartCode))); expect(localizationsFile, isNot(contains(intlImportDartCode)));
}); });
testUsingContext('intl package import should be kept in subclass files when plurals are included', () { testWithoutContext('intl package import should be kept in subclass files when plurals are included', () {
const String pluralMessageArb = ''' const String pluralMessageArb = '''
{ {
"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": "{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}}",
...@@ -1809,7 +1806,7 @@ import 'output-localization-file_en.dart' deferred as output-localization-file_e ...@@ -1809,7 +1806,7 @@ import 'output-localization-file_en.dart' deferred as output-localization-file_e
expect(localizationsFile, contains(intlImportDartCode)); expect(localizationsFile, contains(intlImportDartCode));
}); });
testUsingContext('check indentation on generated files', () { testWithoutContext('check indentation on generated files', () {
_standardFlutterDirectoryL10nSetup(fs); _standardFlutterDirectoryL10nSetup(fs);
try { try {
...@@ -1845,7 +1842,7 @@ import 'output-localization-file_en.dart' deferred as output-localization-file_e ...@@ -1845,7 +1842,7 @@ import 'output-localization-file_en.dart' deferred as output-localization-file_e
expect(localizationsFile.contains(' ];'), true); expect(localizationsFile.contains(' ];'), true);
}); });
testUsingContext('foundation package import should be omitted from file template when deferred loading = true', () { testWithoutContext('foundation package import should be omitted from file template when deferred loading = true', () {
fs.currentDirectory.childDirectory('lib').childDirectory('l10n')..createSync(recursive: true) fs.currentDirectory.childDirectory('lib').childDirectory('l10n')..createSync(recursive: true)
..childFile(defaultTemplateArbFileName).writeAsStringSync(singleMessageArbFileString) ..childFile(defaultTemplateArbFileName).writeAsStringSync(singleMessageArbFileString)
..childFile('app_es.arb').writeAsStringSync(singleEsMessageArbFileString); ..childFile('app_es.arb').writeAsStringSync(singleEsMessageArbFileString);
...@@ -1872,7 +1869,7 @@ import 'output-localization-file_en.dart' deferred as output-localization-file_e ...@@ -1872,7 +1869,7 @@ import 'output-localization-file_en.dart' deferred as output-localization-file_e
expect(localizationsFile, isNot(contains(foundationImportDartCode))); expect(localizationsFile, isNot(contains(foundationImportDartCode)));
}); });
testUsingContext('foundation package import should be kept in file template when deferred loading = false', () { testWithoutContext('foundation package import should be kept in file template when deferred loading = false', () {
fs.currentDirectory.childDirectory('lib').childDirectory('l10n')..createSync(recursive: true) fs.currentDirectory.childDirectory('lib').childDirectory('l10n')..createSync(recursive: true)
..childFile(defaultTemplateArbFileName).writeAsStringSync(singleMessageArbFileString) ..childFile(defaultTemplateArbFileName).writeAsStringSync(singleMessageArbFileString)
..childFile('app_es.arb').writeAsStringSync(singleEsMessageArbFileString); ..childFile('app_es.arb').writeAsStringSync(singleEsMessageArbFileString);
...@@ -1899,7 +1896,7 @@ import 'output-localization-file_en.dart' deferred as output-localization-file_e ...@@ -1899,7 +1896,7 @@ import 'output-localization-file_en.dart' deferred as output-localization-file_e
expect(localizationsFile, contains(foundationImportDartCode)); expect(localizationsFile, contains(foundationImportDartCode));
}); });
testUsingContext('check for string interpolation rules', () { testWithoutContext('check for string interpolation rules', () {
const String enArbCheckList = ''' const String enArbCheckList = '''
{ {
"one": "The number of {one} elapsed is: 44", "one": "The number of {one} elapsed is: 44",
...@@ -2039,7 +2036,7 @@ import 'output-localization-file_en.dart' deferred as output-localization-file_e ...@@ -2039,7 +2036,7 @@ import 'output-localization-file_en.dart' deferred as output-localization-file_e
expect(localizationsFile, contains(r'${nine}')); expect(localizationsFile, contains(r'${nine}'));
}); });
testUsingContext('check for string interpolation rules - plurals', () { testWithoutContext('check for string interpolation rules - plurals', () {
const String enArbCheckList = ''' const String enArbCheckList = '''
{ {
"first": "{count,plural, =0{test {count} test} =1{哈{count}哈} =2{m{count}m} few{_{count}_} many{{count} test} other{{count}m}", "first": "{count,plural, =0{test {count} test} =1{哈{count}哈} =2{m{count}m} few{_{count}_} many{{count} test} other{{count}m}",
...@@ -2104,7 +2101,7 @@ import 'output-localization-file_en.dart' deferred as output-localization-file_e ...@@ -2104,7 +2101,7 @@ import 'output-localization-file_en.dart' deferred as output-localization-file_e
expect(localizationsFile, contains(r' $count')); expect(localizationsFile, contains(r' $count'));
}); });
testUsingContext( testWithoutContext(
'should throw with descriptive error message when failing to parse the ' 'should throw with descriptive error message when failing to parse the '
'arb file', 'arb file',
() { () {
...@@ -2145,7 +2142,7 @@ import 'output-localization-file_en.dart' deferred as output-localization-file_e ...@@ -2145,7 +2142,7 @@ import 'output-localization-file_en.dart' deferred as output-localization-file_e
}, },
); );
testUsingContext('should throw when resource is missing resource attribute (isResourceAttributeRequired = true)', () { testWithoutContext('should throw when resource is missing resource attribute (isResourceAttributeRequired = true)', () {
const String arbFileWithMissingResourceAttribute = ''' const String arbFileWithMissingResourceAttribute = '''
{ {
"title": "Stocks" "title": "Stocks"
...@@ -2179,7 +2176,7 @@ import 'output-localization-file_en.dart' deferred as output-localization-file_e ...@@ -2179,7 +2176,7 @@ import 'output-localization-file_en.dart' deferred as output-localization-file_e
}); });
group('checks for method/getter formatting', () { group('checks for method/getter formatting', () {
testUsingContext('cannot contain non-alphanumeric symbols', () { testWithoutContext('cannot contain non-alphanumeric symbols', () {
const String nonAlphaNumericArbFile = ''' const String nonAlphaNumericArbFile = '''
{ {
"title!!": "Stocks", "title!!": "Stocks",
...@@ -2211,7 +2208,7 @@ import 'output-localization-file_en.dart' deferred as output-localization-file_e ...@@ -2211,7 +2208,7 @@ import 'output-localization-file_en.dart' deferred as output-localization-file_e
fail('should fail due to non-alphanumeric character.'); fail('should fail due to non-alphanumeric character.');
}); });
testUsingContext('must start with lowercase character', () { testWithoutContext('must start with lowercase character', () {
const String nonAlphaNumericArbFile = ''' const String nonAlphaNumericArbFile = '''
{ {
"Title": "Stocks", "Title": "Stocks",
...@@ -2243,7 +2240,7 @@ import 'output-localization-file_en.dart' deferred as output-localization-file_e ...@@ -2243,7 +2240,7 @@ import 'output-localization-file_en.dart' deferred as output-localization-file_e
fail('should fail since key starts with a non-lowercase.'); fail('should fail since key starts with a non-lowercase.');
}); });
testUsingContext('cannot start with a number', () { testWithoutContext('cannot start with a number', () {
const String nonAlphaNumericArbFile = ''' const String nonAlphaNumericArbFile = '''
{ {
"123title": "Stocks", "123title": "Stocks",
...@@ -2276,7 +2273,7 @@ import 'output-localization-file_en.dart' deferred as output-localization-file_e ...@@ -2276,7 +2273,7 @@ import 'output-localization-file_en.dart' deferred as output-localization-file_e
}); });
}); });
testUsingContext('should generate a valid pubspec.yaml file when using synthetic package if it does not already exist', () { testWithoutContext('should generate a valid pubspec.yaml file when using synthetic package if it does not already exist', () {
_standardFlutterDirectoryL10nSetup(fs); _standardFlutterDirectoryL10nSetup(fs);
try { try {
LocalizationsGenerator( LocalizationsGenerator(
...@@ -2306,7 +2303,7 @@ import 'output-localization-file_en.dart' deferred as output-localization-file_e ...@@ -2306,7 +2303,7 @@ import 'output-localization-file_en.dart' deferred as output-localization-file_e
expect(pubspecDescription, "The Flutter application's synthetic package."); expect(pubspecDescription, "The Flutter application's synthetic package.");
}); });
testUsingContext('should not overwrite existing pubspec.yaml file when using synthetic package', () { testWithoutContext('should not overwrite existing pubspec.yaml file when using synthetic package', () {
_standardFlutterDirectoryL10nSetup(fs); _standardFlutterDirectoryL10nSetup(fs);
final File pubspecFile = fs.file(fs.path.join(syntheticPackagePath, 'pubspec.yaml')) final File pubspecFile = fs.file(fs.path.join(syntheticPackagePath, 'pubspec.yaml'))
..createSync(recursive: true) ..createSync(recursive: true)
......
...@@ -20,7 +20,7 @@ import 'package:flutter_tools/src/project.dart'; ...@@ -20,7 +20,7 @@ import 'package:flutter_tools/src/project.dart';
import 'package:test/fake.dart'; import 'package:test/fake.dart';
import '../../src/common.dart'; import '../../src/common.dart';
import '../../src/context.dart'; import '../../src/fake_process_manager.dart';
import '../../src/fakes.dart'; import '../../src/fakes.dart';
final FakePlatform macOS = FakePlatform( final FakePlatform macOS = FakePlatform(
...@@ -196,7 +196,7 @@ void main() { ...@@ -196,7 +196,7 @@ void main() {
expect(await device.targetPlatformDisplayName, 'darwin-arm64'); expect(await device.targetPlatformDisplayName, 'darwin-arm64');
}); });
testUsingContext('isSupportedForProject is false with no host app', () async { testWithoutContext('isSupportedForProject is false with no host app', () async {
final FileSystem fileSystem = MemoryFileSystem.test(); final FileSystem fileSystem = MemoryFileSystem.test();
final MacOSDevice device = MacOSDevice( final MacOSDevice device = MacOSDevice(
fileSystem: fileSystem, fileSystem: fileSystem,
...@@ -211,7 +211,7 @@ void main() { ...@@ -211,7 +211,7 @@ void main() {
expect(device.isSupportedForProject(flutterProject), false); expect(device.isSupportedForProject(flutterProject), false);
}); });
testUsingContext('executablePathForDevice uses the correct package executable', () async { testWithoutContext('executablePathForDevice uses the correct package executable', () async {
final FakeMacOSApp package = FakeMacOSApp(); final FakeMacOSApp package = FakeMacOSApp();
final MacOSDevice device = MacOSDevice( final MacOSDevice device = MacOSDevice(
fileSystem: MemoryFileSystem.test(), fileSystem: MemoryFileSystem.test(),
......
...@@ -9,7 +9,6 @@ import 'package:file_testing/file_testing.dart'; ...@@ -9,7 +9,6 @@ import 'package:file_testing/file_testing.dart';
import 'package:flutter_tools/src/base/io.dart'; import 'package:flutter_tools/src/base/io.dart';
import '../src/common.dart'; import '../src/common.dart';
import '../src/context.dart';
import 'test_utils.dart'; import 'test_utils.dart';
const String apkDebugMessage = 'A summary of your APK analysis can be found at: '; const String apkDebugMessage = 'A summary of your APK analysis can be found at: ';
...@@ -17,7 +16,7 @@ const String iosDebugMessage = 'A summary of your iOS bundle analysis can be fou ...@@ -17,7 +16,7 @@ const String iosDebugMessage = 'A summary of your iOS bundle analysis can be fou
const String runDevToolsMessage = 'flutter pub global activate devtools; flutter pub global run devtools '; const String runDevToolsMessage = 'flutter pub global activate devtools; flutter pub global run devtools ';
void main() { void main() {
testUsingContext('--analyze-size flag produces expected output on hello_world for Android', () async { testWithoutContext('--analyze-size flag produces expected output on hello_world for Android', () async {
final String workingDirectory = fileSystem.path.join(getFlutterRoot(), 'examples', 'hello_world'); final String workingDirectory = fileSystem.path.join(getFlutterRoot(), 'examples', 'hello_world');
final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter'); final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter');
final ProcessResult result = await processManager.run(<String>[ final ProcessResult result = await processManager.run(<String>[
......
...@@ -11,7 +11,6 @@ import 'package:flutter_tools/src/base/process.dart'; ...@@ -11,7 +11,6 @@ import 'package:flutter_tools/src/base/process.dart';
import 'package:flutter_tools/src/base/terminal.dart'; import 'package:flutter_tools/src/base/terminal.dart';
import '../src/common.dart'; import '../src/common.dart';
import '../src/context.dart';
import 'test_utils.dart'; import 'test_utils.dart';
const String _kInitialVersion = 'v1.9.1'; const String _kInitialVersion = 'v1.9.1';
...@@ -46,7 +45,7 @@ void main() { ...@@ -46,7 +45,7 @@ void main() {
} }
}); });
testUsingContext('Can upgrade and downgrade a Flutter checkout', () async { testWithoutContext('Can upgrade and downgrade a Flutter checkout', () async {
final Directory testDirectory = parentDirectory.childDirectory('flutter'); final Directory testDirectory = parentDirectory.childDirectory('flutter');
testDirectory.createSync(recursive: true); testDirectory.createSync(recursive: true);
......
...@@ -8,7 +8,6 @@ import 'package:file/file.dart'; ...@@ -8,7 +8,6 @@ import 'package:file/file.dart';
import 'package:file_testing/file_testing.dart'; import 'package:file_testing/file_testing.dart';
import '../src/common.dart'; import '../src/common.dart';
import '../src/context.dart';
import 'test_utils.dart'; import 'test_utils.dart';
void main() { void main() {
...@@ -22,7 +21,7 @@ void main() { ...@@ -22,7 +21,7 @@ void main() {
tryToDelete(tempDir); tryToDelete(tempDir);
}); });
testUsingContext('flutter app that depends on a non-Android plugin can still build for Android', () { testWithoutContext('flutter app that depends on a non-Android plugin can still build for Android', () {
final String flutterRoot = getFlutterRoot(); final String flutterRoot = getFlutterRoot();
final String flutterBin = fileSystem.path.join( final String flutterBin = fileSystem.path.join(
flutterRoot, flutterRoot,
......
...@@ -11,7 +11,6 @@ import 'package:flutter_tools/src/base/io.dart'; ...@@ -11,7 +11,6 @@ import 'package:flutter_tools/src/base/io.dart';
import 'package:flutter_tools/src/convert.dart'; import 'package:flutter_tools/src/convert.dart';
import '../src/common.dart'; import '../src/common.dart';
import '../src/context.dart';
import 'test_data/basic_project.dart'; import 'test_data/basic_project.dart';
import 'test_utils.dart'; import 'test_utils.dart';
...@@ -56,7 +55,7 @@ void main() { ...@@ -56,7 +55,7 @@ void main() {
tryToDelete(tempDir); tryToDelete(tempDir);
}); });
testUsingContext('flutter run --observatory-port', () async { testWithoutContext('flutter run --observatory-port', () async {
final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter'); final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter');
final int port = await getFreePort(); final int port = await getFreePort();
// If only --observatory-port is provided, --observatory-port will be used by DDS // If only --observatory-port is provided, --observatory-port will be used by DDS
...@@ -74,7 +73,7 @@ void main() { ...@@ -74,7 +73,7 @@ void main() {
await process.exitCode; await process.exitCode;
}); });
testUsingContext('flutter run --dds-port --observatory-port', () async { testWithoutContext('flutter run --dds-port --observatory-port', () async {
final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter'); final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter');
final int observatoryPort = await getFreePort(); final int observatoryPort = await getFreePort();
int ddsPort = await getFreePort(); int ddsPort = await getFreePort();
...@@ -97,7 +96,7 @@ void main() { ...@@ -97,7 +96,7 @@ void main() {
await process.exitCode; await process.exitCode;
}); });
testUsingContext('flutter run --dds-port', () async { testWithoutContext('flutter run --dds-port', () async {
final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter'); final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter');
final int ddsPort = await getFreePort(); final int ddsPort = await getFreePort();
// If only --dds-port is provided, --dds-port will be used by DDS and the VM service // If only --dds-port is provided, --dds-port will be used by DDS and the VM service
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
import 'package:flutter_tools/src/base/io.dart'; import 'package:flutter_tools/src/base/io.dart';
import '../src/common.dart'; import '../src/common.dart';
import '../src/context.dart';
import 'test_utils.dart'; import 'test_utils.dart';
final String toolBackend = fileSystem.path.join(getFlutterRoot(), 'packages', 'flutter_tools', 'bin', 'tool_backend.dart'); final String toolBackend = fileSystem.path.join(getFlutterRoot(), 'packages', 'flutter_tools', 'bin', 'tool_backend.dart');
...@@ -15,7 +14,7 @@ final String examplePath = fileSystem.path.join(getFlutterRoot(), 'examples', 'h ...@@ -15,7 +14,7 @@ final String examplePath = fileSystem.path.join(getFlutterRoot(), 'examples', 'h
final String dart = fileSystem.path.join(getFlutterRoot(), 'bin', platform.isWindows ? 'dart.bat' : 'dart'); final String dart = fileSystem.path.join(getFlutterRoot(), 'bin', platform.isWindows ? 'dart.bat' : 'dart');
void main() { void main() {
testUsingContext('tool_backend.dart exits if PROJECT_DIR is not set', () async { testWithoutContext('tool_backend.dart exits if PROJECT_DIR is not set', () async {
final ProcessResult result = await processManager.run(<String>[ final ProcessResult result = await processManager.run(<String>[
dart, dart,
toolBackend, toolBackend,
...@@ -27,7 +26,7 @@ void main() { ...@@ -27,7 +26,7 @@ void main() {
expect(result.stderr, contains('PROJECT_DIR environment variable must be set to the location of Flutter project to be built.')); expect(result.stderr, contains('PROJECT_DIR environment variable must be set to the location of Flutter project to be built.'));
}); });
testUsingContext('tool_backend.dart exits if FLUTTER_ROOT is not set', () async { testWithoutContext('tool_backend.dart exits if FLUTTER_ROOT is not set', () async {
// Removing parent environment means that batch script cannot be run. // Removing parent environment means that batch script cannot be run.
final String dart = fileSystem.path.join(getFlutterRoot(), 'bin', 'cache', 'dart-sdk', 'bin', platform.isWindows ? 'dart.exe' : 'dart'); final String dart = fileSystem.path.join(getFlutterRoot(), 'bin', 'cache', 'dart-sdk', 'bin', platform.isWindows ? 'dart.exe' : 'dart');
...@@ -44,7 +43,7 @@ void main() { ...@@ -44,7 +43,7 @@ void main() {
expect(result.stderr, contains('FLUTTER_ROOT environment variable must be set to the location of the Flutter SDK.')); expect(result.stderr, contains('FLUTTER_ROOT environment variable must be set to the location of the Flutter SDK.'));
}); });
testUsingContext('tool_backend.dart exits if local engine does not match build mode', () async { testWithoutContext('tool_backend.dart exits if local engine does not match build mode', () async {
final ProcessResult result = await processManager.run(<String>[ final ProcessResult result = await processManager.run(<String>[
dart, dart,
toolBackend, toolBackend,
......
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