2
2
// for details. All rights reserved. Use of this source code is governed by a
3
3
// BSD-style license that can be found in the LICENSE file.
4
4
5
- // @dart=2.9
6
-
7
5
library dartdoc.model_test;
8
6
9
7
import 'dart:io' ;
@@ -21,18 +19,17 @@ final Directory _toolExecutableDir = Directory('testing/tool_executables');
21
19
22
20
void main () {
23
21
ToolConfiguration toolMap;
24
- Directory tempDir;
25
- File setupFile;
22
+ Directory ? tempDir;
23
+ late File setupFile;
26
24
27
- ToolRunner runner;
28
- ToolTempFileTracker tracker;
29
- ToolErrorCallback errorCallback;
25
+ late ToolRunner runner;
26
+ late ToolErrorCallback errorCallback;
30
27
final errors = < String > [];
31
28
32
29
setUpAll (() async {
33
- ProcessResult result;
30
+ ProcessResult ? result;
34
31
tempDir = Directory .systemTemp.createTempSync ('tool_runner_test_' );
35
- var snapshotFile = path.join (tempDir.path, 'drill.snapshot' );
32
+ var snapshotFile = path.join (tempDir! .path, 'drill.snapshot' );
36
33
try {
37
34
result = Process .runSync (
38
35
Platform .resolvedExecutable,
@@ -52,7 +49,7 @@ void main() {
52
49
stderr.writeln (result.stderr);
53
50
}
54
51
expect (result? .exitCode, equals (0 ));
55
- setupFile = File (path.join (tempDir.path, 'setup.stamp' ));
52
+ setupFile = File (path.join (tempDir! .path, 'setup.stamp' ));
56
53
var nonDartName = Platform .isWindows ? 'non_dart.bat' : 'non_dart.sh' ;
57
54
var nonDartExecutable =
58
55
path.join (_toolExecutableDir.absolute.path, nonDartName);
@@ -94,13 +91,11 @@ echo:
94
91
runner = ToolRunner (toolMap);
95
92
errorCallback = (String message) => errors.add (message);
96
93
});
94
+
97
95
tearDownAll (() {
98
96
tempDir? .deleteSync (recursive: true );
99
- tracker? .dispose ();
100
97
SnapshotCache .instanceFor (pubPackageMetaProvider.resourceProvider)
101
98
.dispose ();
102
- setupFile = null ;
103
- tempDir = null ;
104
99
});
105
100
106
101
group ('ToolRunner' , () {
@@ -110,7 +105,8 @@ echo:
110
105
// This test must come first, to verify that the first run creates
111
106
// a snapshot.
112
107
test ('Tool definition includes compile arguments.' , () async {
113
- DartToolDefinition definition = runner.toolConfiguration.tools['drill' ];
108
+ var definition =
109
+ runner.toolConfiguration.tools['drill' ] as DartToolDefinition ;
114
110
expect (definition.compileArgs, equals (['--no-sound-null-safety' ]));
115
111
});
116
112
test ('can invoke a Dart tool, and second run is a snapshot.' , () async {
0 commit comments