Migrate generate_synthetic_packages_test.dart to explicit-package-dependencies. (#160267)

Work towards https://github.com/flutter/flutter/issues/160257.

Unlike some of the other PRs, this test explicitly _opts-out_ of the
flag, as the test itself is testing whether the now deprecated feature
works.
This commit is contained in:
Matan Lurey 2024-12-13 14:22:12 -08:00 committed by GitHub
parent 47403e351e
commit 5332e696a4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -21,6 +21,13 @@ import '../../src/fakes.dart';
import '../../src/test_build_system.dart'; import '../../src/test_build_system.dart';
void main() { void main() {
// TODO(matanlurey): Remove after support for flutter_gen is removed.
// See https://github.com/flutter/flutter/issues/102983 for details.
FeatureFlags disableExplicitPackageDependencies() {
// ignore: avoid_redundant_argument_values
return TestFeatureFlags(isExplicitPackageDependenciesEnabled: false);
}
testUsingContext('calls buildSystem.build with blank l10n.yaml file', () async { testUsingContext('calls buildSystem.build with blank l10n.yaml file', () async {
// Project directory setup for gen_l10n logic // Project directory setup for gen_l10n logic
final MemoryFileSystem fileSystem = MemoryFileSystem.test(); final MemoryFileSystem fileSystem = MemoryFileSystem.test();
@ -68,6 +75,8 @@ void main() {
), ),
); );
await completer.future; await completer.future;
}, overrides: <Type, Generator>{
FeatureFlags: disableExplicitPackageDependencies,
}); });
testUsingContext('calls buildSystem.build with l10n.yaml synthetic-package: true', () async { testUsingContext('calls buildSystem.build with l10n.yaml synthetic-package: true', () async {
@ -118,6 +127,8 @@ void main() {
), ),
); );
await completer.future; await completer.future;
}, overrides: <Type, Generator>{
FeatureFlags: disableExplicitPackageDependencies,
}); });
testUsingContext('calls buildSystem.build with l10n.yaml synthetic-package: null', () async { testUsingContext('calls buildSystem.build with l10n.yaml synthetic-package: null', () async {
@ -166,6 +177,8 @@ void main() {
), ),
); );
await completer.future; await completer.future;
}, overrides: <Type, Generator>{
FeatureFlags: disableExplicitPackageDependencies,
}); });
testUsingContext('does not call buildSystem.build when l10n.yaml is not present', () async { testUsingContext('does not call buildSystem.build when l10n.yaml is not present', () async {
@ -305,6 +318,8 @@ void main() {
mockBufferLogger.warningText, mockBufferLogger.warningText,
contains('https://flutter.dev/to/flutter-gen-deprecation'), contains('https://flutter.dev/to/flutter-gen-deprecation'),
); );
}, overrides: <Type, Generator>{
FeatureFlags: disableExplicitPackageDependencies,
}); });
testUsingContext('synthetic-package: true (explicit) logs a deprecation warning', () async { testUsingContext('synthetic-package: true (explicit) logs a deprecation warning', () async {
@ -340,6 +355,8 @@ void main() {
mockBufferLogger.warningText, mockBufferLogger.warningText,
contains('https://flutter.dev/to/flutter-gen-deprecation'), contains('https://flutter.dev/to/flutter-gen-deprecation'),
); );
}, overrides: <Type, Generator>{
FeatureFlags: disableExplicitPackageDependencies,
}); });
testUsingContext('synthetic-package: false has no deprecation warning', () async { testUsingContext('synthetic-package: false has no deprecation warning', () async {