@@ -15,12 +15,11 @@ import 'package:path/path.dart' as path;
1515import 'package:test/test.dart' ;
1616
1717final String newline = Platform .isWindows ? '\r\n ' : '\n ' ;
18- final String scriptSuffix = Platform .isWindows ? ".bat" : "" ;
1918final String executableSuffix = Platform .isWindows ? ".exe" : "" ;
2019final String sdkBinDir = path.dirname (Platform .executable);
2120final String dartaotruntime =
2221 path.join (sdkBinDir, 'dartaotruntime${executableSuffix }' );
23- final String dart2native = path.join (sdkBinDir, 'dart2native${ scriptSuffix }' );
22+ final String dart = path.join (sdkBinDir, 'dart${ executableSuffix }' );
2423
2524Future <void > withTempDir (Future fun (String dir)) async {
2625 final Directory tempDir = Directory .systemTemp.createTempSync ();
@@ -32,14 +31,14 @@ Future<void> withTempDir(Future fun(String dir)) async {
3231}
3332
3433void main (List <String > args) {
35- test ("dart2native : Can compile and run AOT" , () async {
34+ test ("Dart native : Can compile and run AOT snapshot " , () async {
3635 await withTempDir ((String tmp) async {
3736 final String testCode = path.join ('tools' , 'bots' , 'dart_aot_test.dart' );
3837 final String tmpAot = path.join (tmp, 'dart_aot_test.aot' );
3938
4039 {
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 ]);
4342 expect (result.stderr, '' );
4443 expect (result.exitCode, 0 );
4544 }
@@ -55,14 +54,14 @@ void main(List<String> args) {
5554 });
5655 });
5756
58- test ("dart2native : Can compile and run exe" , () async {
57+ test ("Dart native : Can compile and run exe" , () async {
5958 await withTempDir ((String tmp) async {
6059 final String testCode = path.join ('tools' , 'bots' , 'dart_aot_test.dart' );
6160 final String tmpExe = path.join (tmp, 'dart_aot_test.exe' );
6261
6362 {
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]);
6665 expect (result.stderr, '' );
6766 expect (result.exitCode, 0 );
6867 }
@@ -77,27 +76,27 @@ void main(List<String> args) {
7776 });
7877 });
7978
80- test ("dart2native : Returns non-zero on missing file." , () async {
79+ test ("Dart native : Returns non-zero on missing file." , () async {
8180 await withTempDir ((String tmp) async {
8281 final String testCode = path.join (tmp, 'does_not_exist.dart' );
8382 final String tmpExe = path.join (tmp, 'dart_aot_test.exe' );
8483
8584 {
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]);
8887 expect (result.exitCode, isNonZero);
8988 }
9089 });
9190 });
9291
93- test ("dart2native : Returns non-zero on non-file." , () async {
92+ test ("Dart native : Returns non-zero on non-file." , () async {
9493 await withTempDir ((String tmp) async {
9594 final String testCode = tmp; // This is a directory, not a file.
9695 final String tmpExe = path.join (tmp, 'dart_aot_test.exe' );
9796
9897 {
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]);
101100 expect (result.exitCode, isNonZero);
102101 }
103102 });
0 commit comments