@@ -15,12 +15,11 @@ import 'package:path/path.dart' as path;
15
15
import 'package:test/test.dart' ;
16
16
17
17
final String newline = Platform .isWindows ? '\r\n ' : '\n ' ;
18
- final String scriptSuffix = Platform .isWindows ? ".bat" : "" ;
19
18
final String executableSuffix = Platform .isWindows ? ".exe" : "" ;
20
19
final String sdkBinDir = path.dirname (Platform .executable);
21
20
final String dartaotruntime =
22
21
path.join (sdkBinDir, 'dartaotruntime${executableSuffix }' );
23
- final String dart2native = path.join (sdkBinDir, 'dart2native${ scriptSuffix }' );
22
+ final String dart = path.join (sdkBinDir, 'dart${ executableSuffix }' );
24
23
25
24
Future <void > withTempDir (Future fun (String dir)) async {
26
25
final Directory tempDir = Directory .systemTemp.createTempSync ();
@@ -32,14 +31,14 @@ Future<void> withTempDir(Future fun(String dir)) async {
32
31
}
33
32
34
33
void main (List <String > args) {
35
- test ("dart2native : Can compile and run AOT" , () async {
34
+ test ("Dart native : Can compile and run AOT snapshot " , () async {
36
35
await withTempDir ((String tmp) async {
37
36
final String testCode = path.join ('tools' , 'bots' , 'dart_aot_test.dart' );
38
37
final String tmpAot = path.join (tmp, 'dart_aot_test.aot' );
39
38
40
39
{
41
- final ProcessResult result = await Process .run (dart2native,
42
- [testCode , '--output ' , tmpAot , '--output-kind ' , 'aot' ]);
40
+ final ProcessResult result = await Process .run (
41
+ dart, [ 'compile' , 'aot-snapshot ' , testCode , '--output' , tmpAot ]);
43
42
expect (result.stderr, '' );
44
43
expect (result.exitCode, 0 );
45
44
}
@@ -55,14 +54,14 @@ void main(List<String> args) {
55
54
});
56
55
});
57
56
58
- test ("dart2native : Can compile and run exe" , () async {
57
+ test ("Dart native : Can compile and run exe" , () async {
59
58
await withTempDir ((String tmp) async {
60
59
final String testCode = path.join ('tools' , 'bots' , 'dart_aot_test.dart' );
61
60
final String tmpExe = path.join (tmp, 'dart_aot_test.exe' );
62
61
63
62
{
64
- final ProcessResult result =
65
- await Process . run (dart2native , [testCode, '--output' , tmpExe]);
63
+ final ProcessResult result = await Process . run (
64
+ dart , ['compile' , 'exe' , testCode, '--output' , tmpExe]);
66
65
expect (result.stderr, '' );
67
66
expect (result.exitCode, 0 );
68
67
}
@@ -77,27 +76,27 @@ void main(List<String> args) {
77
76
});
78
77
});
79
78
80
- test ("dart2native : Returns non-zero on missing file." , () async {
79
+ test ("Dart native : Returns non-zero on missing file." , () async {
81
80
await withTempDir ((String tmp) async {
82
81
final String testCode = path.join (tmp, 'does_not_exist.dart' );
83
82
final String tmpExe = path.join (tmp, 'dart_aot_test.exe' );
84
83
85
84
{
86
- final ProcessResult result =
87
- await Process . run (dart2native , [testCode, '--output' , tmpExe]);
85
+ final ProcessResult result = await Process . run (
86
+ dart , ['compile' , 'exe' , testCode, '--output' , tmpExe]);
88
87
expect (result.exitCode, isNonZero);
89
88
}
90
89
});
91
90
});
92
91
93
- test ("dart2native : Returns non-zero on non-file." , () async {
92
+ test ("Dart native : Returns non-zero on non-file." , () async {
94
93
await withTempDir ((String tmp) async {
95
94
final String testCode = tmp; // This is a directory, not a file.
96
95
final String tmpExe = path.join (tmp, 'dart_aot_test.exe' );
97
96
98
97
{
99
- final ProcessResult result =
100
- await Process . run (dart2native , [testCode, '--output' , tmpExe]);
98
+ final ProcessResult result = await Process . run (
99
+ dart , ['compile' , 'exe' , testCode, '--output' , tmpExe]);
101
100
expect (result.exitCode, isNonZero);
102
101
}
103
102
});
0 commit comments