From 25c10d6a1cac11bd7ef93adfefc58b1bd831d022 Mon Sep 17 00:00:00 2001 From: Jenn Magder Date: Thu, 13 May 2021 23:09:03 -0700 Subject: [PATCH] Replace testUsingContext with testWithoutContext in a few places (#82498) --- .../general.shard/desktop_device_test.dart | 4 +- .../device_port_forwarder_test.dart | 7 +- .../generate_localizations_test.dart | 129 +++++++++--------- .../macos/macos_device_test.dart | 6 +- .../integration.shard/analyze_size_test.dart | 3 +- .../downgrade_upgrade_integration_test.dart | 3 +- .../gradle_non_android_plugin_test.dart | 3 +- .../observatory_port_test.dart | 7 +- .../integration.shard/tool_backend_test.dart | 7 +- 9 files changed, 79 insertions(+), 90 deletions(-) diff --git a/packages/flutter_tools/test/general.shard/desktop_device_test.dart b/packages/flutter_tools/test/general.shard/desktop_device_test.dart index 9a8332ecb7..7984998b36 100644 --- a/packages/flutter_tools/test/general.shard/desktop_device_test.dart +++ b/packages/flutter_tools/test/general.shard/desktop_device_test.dart @@ -22,7 +22,7 @@ import 'package:meta/meta.dart'; import 'package:test/fake.dart'; import '../src/common.dart'; -import '../src/context.dart'; +import '../src/fake_process_manager.dart'; void main() { group('Basic info', () { @@ -244,7 +244,7 @@ void main() { expect(portForwarder.forwardedPorts.isEmpty, true); }); - testUsingContext('createDevFSWriter returns a LocalDevFSWriter', () { + testWithoutContext('createDevFSWriter returns a LocalDevFSWriter', () { final FakeDesktopDevice device = setUpDesktopDevice(); expect(device.createDevFSWriter(null, ''), isA()); diff --git a/packages/flutter_tools/test/general.shard/device_port_forwarder_test.dart b/packages/flutter_tools/test/general.shard/device_port_forwarder_test.dart index 05253b4c81..57024c360c 100644 --- a/packages/flutter_tools/test/general.shard/device_port_forwarder_test.dart +++ b/packages/flutter_tools/test/general.shard/device_port_forwarder_test.dart @@ -2,24 +2,21 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// @dart = 2.8 - import 'dart:io' as io; // ignore: dart_io_import import 'package:flutter_tools/src/base/io.dart'; import 'package:flutter_tools/src/device_port_forwarder.dart'; import 'package:test/fake.dart'; import '../src/common.dart'; -import '../src/context.dart'; 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); expect(forwardedPort.context, isNull); forwardedPort.dispose(); }); - testUsingContext('dispose kills process if process was available', () { + testWithoutContext('dispose kills process if process was available', () { final FakeProcess process = FakeProcess(); final ForwardedPort forwardedPort = ForwardedPort.withContext(123, 456, process); forwardedPort.dispose(); diff --git a/packages/flutter_tools/test/general.shard/generate_localizations_test.dart b/packages/flutter_tools/test/general.shard/generate_localizations_test.dart index 3003e7770e..100dacc832 100644 --- a/packages/flutter_tools/test/general.shard/generate_localizations_test.dart +++ b/packages/flutter_tools/test/general.shard/generate_localizations_test.dart @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// @dart = 2.8 - import 'package:file/memory.dart'; import 'package:flutter_tools/src/base/file_system.dart'; import 'package:flutter_tools/src/base/logger.dart'; @@ -14,7 +12,6 @@ import 'package:flutter_tools/src/localizations/localizations_utils.dart'; import 'package:yaml/yaml.dart'; import '../src/common.dart'; -import '../src/context.dart'; const String defaultTemplateArbFileName = 'app_en.arb'; const String defaultOutputFileString = 'output-localization-file.dart'; @@ -68,10 +65,10 @@ void _standardFlutterDirectoryL10nSetup(FileSystem fs) { } void main() { - MemoryFileSystem fs; - String defaultL10nPathString; - String syntheticPackagePath; - String syntheticL10nPackagePath; + late MemoryFileSystem fs; + late String defaultL10nPathString; + late String syntheticPackagePath; + late String syntheticL10nPackagePath; setUp(() { fs = MemoryFileSystem.test(); @@ -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. final Directory l10nDirectory = fs.currentDirectory .childDirectory('absolute') @@ -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); LocalizationsGenerator generator; @@ -283,7 +280,7 @@ void main() { 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') ..createSync(recursive: true) ..childFile(defaultTemplateArbFileName).writeAsStringSync(singleMessageArbFileString) @@ -308,7 +305,7 @@ void main() { 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') ..createSync(recursive: true); l10nDirectory.childFile('app_localizations_en.arb') @@ -335,7 +332,7 @@ void main() { 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') ..createSync(recursive: true); l10nDirectory.childFile('app_localizations_en.arb') @@ -358,7 +355,7 @@ void main() { 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') ..createSync(recursive: true) ..childFile(defaultTemplateArbFileName).writeAsStringSync(twoMessageArbFileString) @@ -394,7 +391,7 @@ void main() { 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') ..createSync(recursive: true) ..childFile(defaultTemplateArbFileName).writeAsStringSync(twoMessageArbFileString) @@ -431,7 +428,7 @@ void main() { expect(unimplementedOutputString, contains('subtitle')); }); - testUsingContext( + testWithoutContext( 'untranslated messages suggestion is printed when translation is missing: ' 'command line message', () { @@ -468,7 +465,7 @@ void main() { }, ); - testUsingContext( + testWithoutContext( 'untranslated messages suggestion is printed when translation is missing: ' 'l10n.yaml message', () { @@ -503,7 +500,7 @@ void main() { }, ); - testUsingContext( + testWithoutContext( 'unimplemented messages suggestion is not printed when all messages ' 'are fully translated', () { @@ -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); try { @@ -563,7 +560,7 @@ void main() { expect(outputList, contains(contains('unimplemented_message_translations.json'))); }); - testUsingContext( + testWithoutContext( 'uses inputPathString as outputPathString when the outputPathString is ' 'null while not using the synthetic package option', () { @@ -591,7 +588,7 @@ void main() { }, ); - testUsingContext( + testWithoutContext( 'correctly generates output files in non-default output directory if it ' 'already exists while not using the synthetic package option', () { @@ -633,7 +630,7 @@ void main() { }, ); - testUsingContext( + testWithoutContext( 'correctly creates output directory if it does not exist and writes files ' 'in it while not using the synthetic package option', () { @@ -663,7 +660,7 @@ void main() { }, ); - testUsingContext( + testWithoutContext( 'generates nullable localizations class getter via static `of` method ' 'by default', () { @@ -699,7 +696,7 @@ void main() { }, ); - testUsingContext( + testWithoutContext( 'can generate non-nullable localizations class getter via static `of` method ', () { _standardFlutterDirectoryL10nSetup(fs); @@ -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); try { @@ -771,7 +768,7 @@ void main() { 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') ..createSync(recursive: true) ..childFile(defaultTemplateArbFileName).writeAsStringSync(singleMessageArbFileString) @@ -797,7 +794,7 @@ void main() { 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') ..createSync(recursive: true); l10nDirectory.childFile(defaultTemplateArbFileName) @@ -860,11 +857,11 @@ void main() { expect(generator.preferredSupportedLocales.single, LocaleInfo.fromString('es')); expect(generator.header, 'HEADER'); 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.projectDirectory.path, '/'); + expect(generator.projectDirectory?.path, '/'); expect(generator.areResourceAttributesRequired, isTrue); - expect(generator.untranslatedMessagesFile.path, 'untranslated'); + expect(generator.untranslatedMessagesFile?.path, 'untranslated'); expect(generator.usesNullableGetter, isFalse); // Just validate one file. @@ -926,7 +923,7 @@ flutter: }); group('loadResources', () { - testUsingContext('correctly initializes supportedLocales and supportedLanguageCodes properties', () { + testWithoutContext('correctly initializes supportedLocales and supportedLanguageCodes properties', () { _standardFlutterDirectoryL10nSetup(fs); LocalizationsGenerator generator; @@ -947,7 +944,7 @@ flutter: 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') ..createSync(recursive: true); // Write files in non-alphabetical order so that read performs in that order @@ -978,7 +975,7 @@ flutter: 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') ..createSync(recursive: true); l10nDirectory.childFile('app_en.arb') @@ -1010,7 +1007,7 @@ flutter: expect(generator.supportedLocales.elementAt(2), LocaleInfo.fromString('en')); }); - testUsingContext( + testWithoutContext( 'throws an error attempting to add preferred locales ' 'when there is no corresponding arb file for that ' 'locale', @@ -1050,7 +1047,7 @@ flutter: }, ); - testUsingContext('correctly sorts arbPathString alphabetically', () { + testWithoutContext('correctly sorts arbPathString alphabetically', () { final Directory l10nDirectory = fs.currentDirectory.childDirectory('lib').childDirectory('l10n') ..createSync(recursive: true); // Write files in non-alphabetical order so that read performs in that order @@ -1081,7 +1078,7 @@ flutter: 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 = ''' { "@@locale": "en", @@ -1126,7 +1123,7 @@ flutter: 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 = ''' { "@@locale": "en", @@ -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') ..createSync(recursive: true) ..childFile('app.arb') @@ -1198,7 +1195,7 @@ flutter: '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 = ''' { "market": "MARKET", @@ -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') ..createSync(recursive: true); l10nDirectory.childFile('app_en_US.arb') @@ -1262,7 +1259,7 @@ flutter: }); 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); final BufferLogger testLogger = BufferLogger.test(); try { @@ -1294,7 +1291,7 @@ flutter: /// **'Title'**''')); }); - testUsingContext('template message translation handles newline characters', () { + testWithoutContext('template message translation handles newline characters', () { final Directory l10nDirectory = fs.currentDirectory.childDirectory('lib').childDirectory('l10n') ..createSync(recursive: true); l10nDirectory.childFile(defaultTemplateArbFileName) @@ -1339,7 +1336,7 @@ flutter: /// **'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') ..createSync(recursive: true); l10nDirectory.childFile(defaultTemplateArbFileName) @@ -1394,7 +1391,7 @@ flutter: /// **'The price of this item is: \${price}'**''')); }); - testUsingContext('should generate a file per language', () { + testWithoutContext('should generate a file per language', () { const String singleEnCaMessageArbFileString = ''' { "title": "Canadian Title" @@ -1428,7 +1425,7 @@ flutter: 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) ..childFile(defaultTemplateArbFileName).writeAsStringSync(singleMessageArbFileString) ..childFile('app_zh.arb').writeAsStringSync(singleZhMessageArbFileString) @@ -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) ..childFile(defaultTemplateArbFileName).writeAsStringSync(singleMessageArbFileString); @@ -1492,7 +1489,7 @@ import 'output-localization-file_en.dart' deferred as output-localization-file_e }); 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 = ''' { "@@locale": "en", @@ -1532,7 +1529,7 @@ import 'output-localization-file_en.dart' deferred as output-localization-file_e 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 = ''' { "springBegins": "Spring begins on {springStartDate}", @@ -1569,7 +1566,7 @@ import 'output-localization-file_en.dart' deferred as output-localization-file_e 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 = ''' { "courseCompletion": "You have completed {progress} of the course.", @@ -1611,7 +1608,7 @@ import 'output-localization-file_en.dart' deferred as output-localization-file_e }); 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 = ''' { "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 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 = ''' { "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 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 = ''' { "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 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 = ''' { "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 }); }); - 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) ..childFile(defaultTemplateArbFileName).writeAsStringSync(singleMessageArbFileString) ..childFile('app_es.arb').writeAsStringSync(singleEsMessageArbFileString); @@ -1765,7 +1762,7 @@ import 'output-localization-file_en.dart' deferred as output-localization-file_e 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 = ''' { "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 expect(localizationsFile, contains(intlImportDartCode)); }); - testUsingContext('check indentation on generated files', () { + testWithoutContext('check indentation on generated files', () { _standardFlutterDirectoryL10nSetup(fs); try { @@ -1845,7 +1842,7 @@ import 'output-localization-file_en.dart' deferred as output-localization-file_e 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) ..childFile(defaultTemplateArbFileName).writeAsStringSync(singleMessageArbFileString) ..childFile('app_es.arb').writeAsStringSync(singleEsMessageArbFileString); @@ -1872,7 +1869,7 @@ import 'output-localization-file_en.dart' deferred as output-localization-file_e 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) ..childFile(defaultTemplateArbFileName).writeAsStringSync(singleMessageArbFileString) ..childFile('app_es.arb').writeAsStringSync(singleEsMessageArbFileString); @@ -1899,7 +1896,7 @@ import 'output-localization-file_en.dart' deferred as output-localization-file_e expect(localizationsFile, contains(foundationImportDartCode)); }); - testUsingContext('check for string interpolation rules', () { + testWithoutContext('check for string interpolation rules', () { const String enArbCheckList = ''' { "one": "The number of {one} elapsed is: 44", @@ -2039,7 +2036,7 @@ import 'output-localization-file_en.dart' deferred as output-localization-file_e expect(localizationsFile, contains(r'${nine}')); }); - testUsingContext('check for string interpolation rules - plurals', () { + testWithoutContext('check for string interpolation rules - plurals', () { const String enArbCheckList = ''' { "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 expect(localizationsFile, contains(r' $count')); }); - testUsingContext( + testWithoutContext( 'should throw with descriptive error message when failing to parse the ' 'arb file', () { @@ -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 = ''' { "title": "Stocks" @@ -2179,7 +2176,7 @@ import 'output-localization-file_en.dart' deferred as output-localization-file_e }); group('checks for method/getter formatting', () { - testUsingContext('cannot contain non-alphanumeric symbols', () { + testWithoutContext('cannot contain non-alphanumeric symbols', () { const String nonAlphaNumericArbFile = ''' { "title!!": "Stocks", @@ -2211,7 +2208,7 @@ import 'output-localization-file_en.dart' deferred as output-localization-file_e fail('should fail due to non-alphanumeric character.'); }); - testUsingContext('must start with lowercase character', () { + testWithoutContext('must start with lowercase character', () { const String nonAlphaNumericArbFile = ''' { "Title": "Stocks", @@ -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.'); }); - testUsingContext('cannot start with a number', () { + testWithoutContext('cannot start with a number', () { const String nonAlphaNumericArbFile = ''' { "123title": "Stocks", @@ -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); try { LocalizationsGenerator( @@ -2306,7 +2303,7 @@ import 'output-localization-file_en.dart' deferred as output-localization-file_e 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); final File pubspecFile = fs.file(fs.path.join(syntheticPackagePath, 'pubspec.yaml')) ..createSync(recursive: true) diff --git a/packages/flutter_tools/test/general.shard/macos/macos_device_test.dart b/packages/flutter_tools/test/general.shard/macos/macos_device_test.dart index 86584956a8..4a4a2d7aa4 100644 --- a/packages/flutter_tools/test/general.shard/macos/macos_device_test.dart +++ b/packages/flutter_tools/test/general.shard/macos/macos_device_test.dart @@ -20,7 +20,7 @@ import 'package:flutter_tools/src/project.dart'; import 'package:test/fake.dart'; import '../../src/common.dart'; -import '../../src/context.dart'; +import '../../src/fake_process_manager.dart'; import '../../src/fakes.dart'; final FakePlatform macOS = FakePlatform( @@ -196,7 +196,7 @@ void main() { 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 MacOSDevice device = MacOSDevice( fileSystem: fileSystem, @@ -211,7 +211,7 @@ void main() { 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 MacOSDevice device = MacOSDevice( fileSystem: MemoryFileSystem.test(), diff --git a/packages/flutter_tools/test/integration.shard/analyze_size_test.dart b/packages/flutter_tools/test/integration.shard/analyze_size_test.dart index 394ad8687d..98a841a81c 100644 --- a/packages/flutter_tools/test/integration.shard/analyze_size_test.dart +++ b/packages/flutter_tools/test/integration.shard/analyze_size_test.dart @@ -9,7 +9,6 @@ import 'package:file_testing/file_testing.dart'; import 'package:flutter_tools/src/base/io.dart'; import '../src/common.dart'; -import '../src/context.dart'; import 'test_utils.dart'; 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 const String runDevToolsMessage = 'flutter pub global activate devtools; flutter pub global run devtools '; 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 flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter'); final ProcessResult result = await processManager.run([ diff --git a/packages/flutter_tools/test/integration.shard/downgrade_upgrade_integration_test.dart b/packages/flutter_tools/test/integration.shard/downgrade_upgrade_integration_test.dart index 9e901e7cc0..ea7d48eeb1 100644 --- a/packages/flutter_tools/test/integration.shard/downgrade_upgrade_integration_test.dart +++ b/packages/flutter_tools/test/integration.shard/downgrade_upgrade_integration_test.dart @@ -11,7 +11,6 @@ import 'package:flutter_tools/src/base/process.dart'; import 'package:flutter_tools/src/base/terminal.dart'; import '../src/common.dart'; -import '../src/context.dart'; import 'test_utils.dart'; const String _kInitialVersion = 'v1.9.1'; @@ -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'); testDirectory.createSync(recursive: true); diff --git a/packages/flutter_tools/test/integration.shard/gradle_non_android_plugin_test.dart b/packages/flutter_tools/test/integration.shard/gradle_non_android_plugin_test.dart index 5d14f52fea..52fd6eea9d 100644 --- a/packages/flutter_tools/test/integration.shard/gradle_non_android_plugin_test.dart +++ b/packages/flutter_tools/test/integration.shard/gradle_non_android_plugin_test.dart @@ -8,7 +8,6 @@ import 'package:file/file.dart'; import 'package:file_testing/file_testing.dart'; import '../src/common.dart'; -import '../src/context.dart'; import 'test_utils.dart'; void main() { @@ -22,7 +21,7 @@ void main() { 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 flutterBin = fileSystem.path.join( flutterRoot, diff --git a/packages/flutter_tools/test/integration.shard/observatory_port_test.dart b/packages/flutter_tools/test/integration.shard/observatory_port_test.dart index bb3c44964c..9968488967 100644 --- a/packages/flutter_tools/test/integration.shard/observatory_port_test.dart +++ b/packages/flutter_tools/test/integration.shard/observatory_port_test.dart @@ -11,7 +11,6 @@ import 'package:flutter_tools/src/base/io.dart'; import 'package:flutter_tools/src/convert.dart'; import '../src/common.dart'; -import '../src/context.dart'; import 'test_data/basic_project.dart'; import 'test_utils.dart'; @@ -56,7 +55,7 @@ void main() { tryToDelete(tempDir); }); - testUsingContext('flutter run --observatory-port', () async { + testWithoutContext('flutter run --observatory-port', () async { final String flutterBin = fileSystem.path.join(getFlutterRoot(), 'bin', 'flutter'); final int port = await getFreePort(); // If only --observatory-port is provided, --observatory-port will be used by DDS @@ -74,7 +73,7 @@ void main() { 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 int observatoryPort = await getFreePort(); int ddsPort = await getFreePort(); @@ -97,7 +96,7 @@ void main() { 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 int ddsPort = await getFreePort(); // If only --dds-port is provided, --dds-port will be used by DDS and the VM service diff --git a/packages/flutter_tools/test/integration.shard/tool_backend_test.dart b/packages/flutter_tools/test/integration.shard/tool_backend_test.dart index 9f16f3b310..33b4873c1e 100644 --- a/packages/flutter_tools/test/integration.shard/tool_backend_test.dart +++ b/packages/flutter_tools/test/integration.shard/tool_backend_test.dart @@ -7,7 +7,6 @@ import 'package:flutter_tools/src/base/io.dart'; import '../src/common.dart'; -import '../src/context.dart'; import 'test_utils.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 final String dart = fileSystem.path.join(getFlutterRoot(), 'bin', platform.isWindows ? 'dart.bat' : 'dart'); 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([ dart, toolBackend, @@ -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.')); }); - 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. final String dart = fileSystem.path.join(getFlutterRoot(), 'bin', 'cache', 'dart-sdk', 'bin', platform.isWindows ? 'dart.exe' : 'dart'); @@ -44,7 +43,7 @@ void main() { 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([ dart, toolBackend,