OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
| 5 import "package:expect/expect.dart"; |
5 import 'dart:io'; | 6 import 'dart:io'; |
6 import 'dart:isolate'; | 7 import 'dart:isolate'; |
7 | 8 |
8 main() { | 9 main() { |
9 var port = new ReceivePort(); | 10 var port = new ReceivePort(); |
10 var executable = new File(new Options().executable).fullPathSync(); | 11 var executable = new File(new Options().executable).fullPathSync(); |
11 var tempDir = new Directory('').createTempSync(); | 12 var tempDir = new Directory('').createTempSync(); |
12 var nonAsciiDir = new Directory('${tempDir.path}/æøå'); | 13 var nonAsciiDir = new Directory('${tempDir.path}/æøå'); |
13 nonAsciiDir.createSync(); | 14 nonAsciiDir.createSync(); |
14 var nonAsciiFile = new File('${nonAsciiDir.path}/æøå.dart'); | 15 var nonAsciiFile = new File('${nonAsciiDir.path}/æøå.dart'); |
15 nonAsciiFile.writeAsStringSync( | 16 nonAsciiFile.writeAsStringSync( |
16 """ | 17 """ |
17 import 'dart:io'; | 18 import 'dart:io'; |
18 | 19 |
19 main() { | 20 main() { |
20 Expect.equals('æøå', new File('æøå.txt').readAsStringSync()); | 21 if ('æøå' != new File('æøå.txt').readAsStringSync()) { |
| 22 throw new RuntimeError("not equal"); |
| 23 } |
21 } | 24 } |
22 """); | 25 """); |
23 var nonAsciiTxtFile = new File('${nonAsciiDir.path}/æøå.txt'); | 26 var nonAsciiTxtFile = new File('${nonAsciiDir.path}/æøå.txt'); |
24 nonAsciiTxtFile.writeAsStringSync('æøå'); | 27 nonAsciiTxtFile.writeAsStringSync('æøå'); |
25 var options = new ProcessOptions(); | 28 var options = new ProcessOptions(); |
26 options.workingDirectory = nonAsciiDir.path; | 29 options.workingDirectory = nonAsciiDir.path; |
27 var script = nonAsciiFile.path; | 30 var script = nonAsciiFile.path; |
28 Process.run(executable, [script], options).then((result) { | 31 Process.run(executable, [script], options).then((result) { |
29 Expect.equals(0, result.exitCode); | 32 Expect.equals(0, result.exitCode); |
30 tempDir.deleteSync(recursive: true); | 33 tempDir.deleteSync(recursive: true); |
31 port.close(); | 34 port.close(); |
32 }); | 35 }); |
33 } | 36 } |
OLD | NEW |