diff --git a/test/markdown_processor_test.dart b/test/markdown_processor_test.dart index 9a5dce0a83..61a900bad2 100644 --- a/test/markdown_processor_test.dart +++ b/test/markdown_processor_test.dart @@ -2,8 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -// @dart=2.9 - library dartdoc.markdown_processor_test; import 'package:dartdoc/src/markdown_processor.dart'; diff --git a/test/model_utils_test.dart b/test/model_utils_test.dart index 1705a51362..850c2d4901 100644 --- a/test/model_utils_test.dart +++ b/test/model_utils_test.dart @@ -2,8 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -// @dart=2.9 - library dartdoc.model_utils_test; import 'package:dartdoc/src/model_utils.dart'; diff --git a/test/quiver_test.dart b/test/quiver_test.dart index a44c2f1330..07cdb6e472 100644 --- a/test/quiver_test.dart +++ b/test/quiver_test.dart @@ -2,8 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -// @dart=2.9 - import 'package:dartdoc/src/quiver.dart'; import 'package:test/test.dart'; @@ -30,20 +28,6 @@ void main() { [1, 2, 3, -1, -2, -3]); }); - test('should throw for null input', () { - expect(() => concat(null), throwsNoSuchMethodError); - }); - - test('should throw if any input is null', () { - expect( - () => concat([ - [1, 2], - null, - [3, 4] - ]).toList(), - throwsNoSuchMethodError); - }); - test('should reflectchanges in the inputs', () { var a = [1, 2]; var b = [4, 5]; diff --git a/test/resource_loader_test.dart b/test/resource_loader_test.dart index 2962f71ba9..8b267a9312 100644 --- a/test/resource_loader_test.dart +++ b/test/resource_loader_test.dart @@ -2,22 +2,15 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -// @dart=2.9 - library dartdoc.resource_loader_test; -import 'package:analyzer/file_system/file_system.dart'; import 'package:analyzer/file_system/physical_file_system.dart'; import 'package:dartdoc/src/generator/resource_loader.dart'; import 'package:test/test.dart'; void main() { group('Resource Loader', () { - ResourceProvider resourceProvider; - - setUp(() { - resourceProvider = PhysicalResourceProvider(); - }); + var resourceProvider = PhysicalResourceProvider(); test('load from packages', () async { var contents = await resourceProvider diff --git a/test/source_linker_test.dart b/test/source_linker_test.dart index 3dadd46e89..3cf1f50f56 100644 --- a/test/source_linker_test.dart +++ b/test/source_linker_test.dart @@ -2,8 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -// @dart=2.9 - library dartdoc.source_linker_test; import 'package:dartdoc/src/dartdoc_options.dart'; diff --git a/test/tool_runner_test.dart b/test/tool_runner_test.dart index 20985b7d99..18fab74391 100644 --- a/test/tool_runner_test.dart +++ b/test/tool_runner_test.dart @@ -2,8 +2,6 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -// @dart=2.9 - library dartdoc.model_test; import 'dart:io'; @@ -21,18 +19,17 @@ final Directory _toolExecutableDir = Directory('testing/tool_executables'); void main() { ToolConfiguration toolMap; - Directory tempDir; - File setupFile; + Directory? tempDir; + late File setupFile; - ToolRunner runner; - ToolTempFileTracker tracker; - ToolErrorCallback errorCallback; + late ToolRunner runner; + late ToolErrorCallback errorCallback; final errors = []; setUpAll(() async { - ProcessResult result; + ProcessResult? result; tempDir = Directory.systemTemp.createTempSync('tool_runner_test_'); - var snapshotFile = path.join(tempDir.path, 'drill.snapshot'); + var snapshotFile = path.join(tempDir!.path, 'drill.snapshot'); try { result = Process.runSync( Platform.resolvedExecutable, @@ -52,7 +49,7 @@ void main() { stderr.writeln(result.stderr); } expect(result?.exitCode, equals(0)); - setupFile = File(path.join(tempDir.path, 'setup.stamp')); + setupFile = File(path.join(tempDir!.path, 'setup.stamp')); var nonDartName = Platform.isWindows ? 'non_dart.bat' : 'non_dart.sh'; var nonDartExecutable = path.join(_toolExecutableDir.absolute.path, nonDartName); @@ -94,13 +91,11 @@ echo: runner = ToolRunner(toolMap); errorCallback = (String message) => errors.add(message); }); + tearDownAll(() { tempDir?.deleteSync(recursive: true); - tracker?.dispose(); SnapshotCache.instanceFor(pubPackageMetaProvider.resourceProvider) .dispose(); - setupFile = null; - tempDir = null; }); group('ToolRunner', () { @@ -110,7 +105,8 @@ echo: // This test must come first, to verify that the first run creates // a snapshot. test('Tool definition includes compile arguments.', () async { - DartToolDefinition definition = runner.toolConfiguration.tools['drill']; + var definition = + runner.toolConfiguration.tools['drill'] as DartToolDefinition; expect(definition.compileArgs, equals(['--no-sound-null-safety'])); }); test('can invoke a Dart tool, and second run is a snapshot.', () async { diff --git a/test/utils_test.dart b/test/utils_test.dart index 4dcf171d2b..28a75e2c72 100644 --- a/test/utils_test.dart +++ b/test/utils_test.dart @@ -2,16 +2,14 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -// @dart=2.9 - library dartdoc.utils_test; import 'package:dartdoc/src/utils.dart'; import 'package:test/test.dart'; void main() { - String comment; - String documentation; + late String comment; + late String documentation; // For readability, the multiline strings below have a left margin. This // is the length of that left margin. diff --git a/test/warnings_test.dart b/test/warnings_test.dart index f4f571abf9..e4abd2320a 100644 --- a/test/warnings_test.dart +++ b/test/warnings_test.dart @@ -17,12 +17,11 @@ import 'package:test/test.dart'; void main() { ResourceProvider resourceProvider = PhysicalResourceProvider.INSTANCE; - Folder tempDir, testPackageOne, testPackageTwo, testPackageThree; - File pubspecYamlOne, pubspecYamlTwo, pubspecYamlThree, dartdocYamlThree; + Folder testPackageOne, testPackageTwo, testPackageThree; DartdocOptionSet optionSet; setUpAll(() { - tempDir = resourceProvider.createSystemTemp('warnings_test'); + var tempDir = resourceProvider.createSystemTemp('warnings_test'); testPackageOne = resourceProvider.getFolder( resourceProvider.pathContext.join(tempDir.path, 'test_package_one')) ..create(); @@ -32,13 +31,13 @@ void main() { testPackageThree = resourceProvider.getFolder( resourceProvider.pathContext.join(tempDir.path, 'test_package_three')) ..create(); - pubspecYamlOne = resourceProvider.getFile( + var pubspecYamlOne = resourceProvider.getFile( resourceProvider.pathContext.join(testPackageOne.path, 'pubspec.yaml')); pubspecYamlOne.writeAsStringSync('name: test_package_one'); - pubspecYamlTwo = resourceProvider.getFile( + var pubspecYamlTwo = resourceProvider.getFile( resourceProvider.pathContext.join(testPackageTwo.path, 'pubspec.yaml')); pubspecYamlTwo.writeAsStringSync('name: test_package_two'); - dartdocYamlThree = resourceProvider.getFile(resourceProvider.pathContext + var dartdocYamlThree = resourceProvider.getFile(resourceProvider.pathContext .join(testPackageThree.path, 'dartdoc_options.yaml')); dartdocYamlThree.writeAsStringSync(''' dartdoc: @@ -50,7 +49,7 @@ dartdoc: ignore: - ambiguous-reexport '''); - pubspecYamlThree = resourceProvider.getFile(resourceProvider.pathContext + var pubspecYamlThree = resourceProvider.getFile(resourceProvider.pathContext .join(testPackageThree.path, 'pubspec.yaml')); pubspecYamlThree.writeAsStringSync('name: test_package_three'); });