@@ -267,185 +267,4 @@ void main() {
267267 throwsToolExit (message: 'to have a bool value, instead was "nonBoolValue"' ),
268268 );
269269 });
270-
271- testWithoutContext ('synthetic-package: true (implicit) logs a deprecation warning' , () async {
272- // Project directory setup for gen_l10n logic.
273- final MemoryFileSystem fileSystem = MemoryFileSystem .test ();
274-
275- // Add generate:true to pubspec.yaml.
276- final File pubspecFile = fileSystem.file ('pubspec.yaml' )..createSync ();
277- final String content = pubspecFile.readAsStringSync ().replaceFirst (
278- '\n flutter:\n ' ,
279- '\n flutter:\n generate: true\n ' ,
280- );
281- pubspecFile.writeAsStringSync (content);
282-
283- // Create a blank l10n.yaml file.
284- fileSystem.file ('l10n.yaml' ).writeAsStringSync ('' );
285-
286- final BufferLogger mockBufferLogger = BufferLogger .test ();
287- final Environment environment = Environment .test (
288- fileSystem.currentDirectory,
289- fileSystem: fileSystem,
290- logger: mockBufferLogger,
291- artifacts: Artifacts .test (),
292- processManager: FakeProcessManager .any (),
293- );
294- final TestBuildSystem buildSystem = TestBuildSystem .all (BuildResult (success: true ));
295-
296- await generateLocalizationsSyntheticPackage (
297- environment: environment,
298- buildSystem: buildSystem,
299- buildTargets: const BuildTargetsImpl (),
300- );
301-
302- expect (
303- mockBufferLogger.warningText,
304- contains ('https://flutter.dev/to/flutter-gen-deprecation' ),
305- );
306- });
307-
308- testWithoutContext ('synthetic-package: true (explicit) logs a deprecation warning' , () async {
309- // Project directory setup for gen_l10n logic.
310- final MemoryFileSystem fileSystem = MemoryFileSystem .test ();
311-
312- // Add generate:true to pubspec.yaml.
313- final File pubspecFile = fileSystem.file ('pubspec.yaml' )..createSync ();
314- final String content = pubspecFile.readAsStringSync ().replaceFirst (
315- '\n flutter:\n ' ,
316- '\n flutter:\n generate: true\n ' ,
317- );
318- pubspecFile.writeAsStringSync (content);
319- fileSystem.file ('l10n.yaml' ).writeAsStringSync ('synthetic-package: true' );
320-
321- final BufferLogger mockBufferLogger = BufferLogger .test ();
322- final Environment environment = Environment .test (
323- fileSystem.currentDirectory,
324- fileSystem: fileSystem,
325- logger: mockBufferLogger,
326- artifacts: Artifacts .test (),
327- processManager: FakeProcessManager .any (),
328- );
329- final TestBuildSystem buildSystem = TestBuildSystem .all (BuildResult (success: true ));
330-
331- await generateLocalizationsSyntheticPackage (
332- environment: environment,
333- buildSystem: buildSystem,
334- buildTargets: const BuildTargetsImpl (),
335- );
336-
337- expect (
338- mockBufferLogger.warningText,
339- contains ('https://flutter.dev/to/flutter-gen-deprecation' ),
340- );
341- });
342-
343- testWithoutContext ('synthetic-package: false has no deprecation warning' , () async {
344- // Project directory setup for gen_l10n logic
345- final MemoryFileSystem fileSystem = MemoryFileSystem .test ();
346-
347- // Add generate:true to pubspec.yaml.
348- final File pubspecFile = fileSystem.file ('pubspec.yaml' )..createSync ();
349- final String content = pubspecFile.readAsStringSync ().replaceFirst (
350- '\n flutter:\n ' ,
351- '\n flutter:\n generate: true\n ' ,
352- );
353- pubspecFile.writeAsStringSync (content);
354- fileSystem.file ('l10n.yaml' ).writeAsStringSync ('synthetic-package: false' );
355-
356- final BufferLogger mockBufferLogger = BufferLogger .test ();
357- final Environment environment = Environment .test (
358- fileSystem.currentDirectory,
359- fileSystem: fileSystem,
360- logger: mockBufferLogger,
361- artifacts: Artifacts .test (),
362- processManager: FakeProcessManager .any (),
363- );
364- final TestBuildSystem buildSystem = TestBuildSystem .all (BuildResult (success: true ));
365-
366- await generateLocalizationsSyntheticPackage (
367- environment: environment,
368- buildSystem: buildSystem,
369- buildTargets: const BuildTargetsImpl (),
370- );
371-
372- expect (
373- mockBufferLogger.warningText,
374- isNot (contains ('https://flutter.dev/to/flutter-gen-deprecation' )),
375- );
376- });
377-
378- testWithoutContext ('synthetic-package: true with --no-implicit-pubspec-resolution is an error' , () async {
379- // Project directory setup for gen_l10n logic
380- final MemoryFileSystem fileSystem = MemoryFileSystem .test ();
381-
382- // Add generate:true to pubspec.yaml.
383- final File pubspecFile = fileSystem.file ('pubspec.yaml' )..createSync ();
384- final String content = pubspecFile.readAsStringSync ().replaceFirst (
385- '\n flutter:\n ' ,
386- '\n flutter:\n generate: true\n ' ,
387- );
388- pubspecFile.writeAsStringSync (content);
389-
390- // Create an l10n.yaml file
391- fileSystem.file ('l10n.yaml' ).writeAsStringSync ('synthetic-package: true' );
392-
393- final BufferLogger mockBufferLogger = BufferLogger .test ();
394- final Environment environment = Environment .test (
395- fileSystem.currentDirectory,
396- fileSystem: fileSystem,
397- logger: mockBufferLogger,
398- artifacts: Artifacts .test (),
399- processManager: FakeProcessManager .any (),
400- useImplicitPubspecResolution: false ,
401- );
402- // Will throw if build is called.
403- final TestBuildSystem buildSystem = TestBuildSystem .all (null );
404-
405- await expectLater (
406- () => generateLocalizationsSyntheticPackage (
407- environment: environment,
408- buildSystem: buildSystem,
409- buildTargets: const NoOpBuildTargets (),
410- ),
411- throwsToolExit (message: 'Cannot generate a synthetic package when --no-implicit-pubspec-resolution is passed' ),
412- );
413- });
414-
415- testWithoutContext ('synthetic-package defaults to false if --no-implicit-pubspec-resolution is passed' , () async {
416- // Project directory setup for gen_l10n logic
417- final MemoryFileSystem fileSystem = MemoryFileSystem .test ();
418-
419- // Add generate:true to pubspec.yaml.
420- final File pubspecFile = fileSystem.file ('pubspec.yaml' )..createSync ();
421- final String content = pubspecFile.readAsStringSync ().replaceFirst (
422- '\n flutter:\n ' ,
423- '\n flutter:\n generate: true\n ' ,
424- );
425- pubspecFile.writeAsStringSync (content);
426-
427- // Create an l10n.yaml file
428- fileSystem.file ('l10n.yaml' ).writeAsStringSync ('' );
429-
430- final BufferLogger mockBufferLogger = BufferLogger .test ();
431- final Environment environment = Environment .test (
432- fileSystem.currentDirectory,
433- fileSystem: fileSystem,
434- logger: mockBufferLogger,
435- artifacts: Artifacts .test (),
436- processManager: FakeProcessManager .any (),
437- useImplicitPubspecResolution: false ,
438- );
439- // Will throw if build is called.
440- final TestBuildSystem buildSystem = TestBuildSystem .all (null );
441-
442- await expectLater (
443- () => generateLocalizationsSyntheticPackage (
444- environment: environment,
445- buildSystem: buildSystem,
446- buildTargets: const NoOpBuildTargets (),
447- ),
448- returnsNormally,
449- );
450- });
451270}
0 commit comments