| 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 'dart:io'; | 5 import 'dart:io'; |
| 6 | 6 |
| 7 import "package:async_helper/async_helper.dart"; | 7 import "package:async_helper/async_helper.dart"; |
| 8 import "package:expect/expect.dart"; | 8 import "package:expect/expect.dart"; |
| 9 | 9 |
| 10 main() { | 10 main() { |
| 11 asyncStart(); | 11 asyncStart(); |
| 12 var executable = new File(Platform.executable).fullPathSync(); | 12 var executable = new File(Platform.executable).resolveSymbolicLinksSync(); |
| 13 var tempDir = Directory.systemTemp.createTempSync('dart_process_non_ascii'); | 13 var tempDir = Directory.systemTemp.createTempSync('dart_process_non_ascii'); |
| 14 var nonAsciiDir = new Directory('${tempDir.path}/æøå'); | 14 var nonAsciiDir = new Directory('${tempDir.path}/æøå'); |
| 15 nonAsciiDir.createSync(); | 15 nonAsciiDir.createSync(); |
| 16 var nonAsciiFile = new File('${nonAsciiDir.path}/æøå.dart'); | 16 var nonAsciiFile = new File('${nonAsciiDir.path}/æøå.dart'); |
| 17 nonAsciiFile.writeAsStringSync( | 17 nonAsciiFile.writeAsStringSync( |
| 18 """ | 18 """ |
| 19 import 'dart:io'; | 19 import 'dart:io'; |
| 20 | 20 |
| 21 main() { | 21 main() { |
| 22 if ('æøå' != new File('æøå.txt').readAsStringSync()) { | 22 if ('æøå' != new File('æøå.txt').readAsStringSync()) { |
| 23 throw new StateError("not equal"); | 23 throw new StateError("not equal"); |
| 24 } | 24 } |
| 25 } | 25 } |
| 26 """); | 26 """); |
| 27 var nonAsciiTxtFile = new File('${nonAsciiDir.path}/æøå.txt'); | 27 var nonAsciiTxtFile = new File('${nonAsciiDir.path}/æøå.txt'); |
| 28 nonAsciiTxtFile.writeAsStringSync('æøå'); | 28 nonAsciiTxtFile.writeAsStringSync('æøå'); |
| 29 var script = nonAsciiFile.path; | 29 var script = nonAsciiFile.path; |
| 30 Process.run(executable, [script], workingDirectory: nonAsciiDir.path) | 30 Process.run(executable, [script], workingDirectory: nonAsciiDir.path) |
| 31 .then((result) { | 31 .then((result) { |
| 32 Expect.equals(0, result.exitCode); | 32 Expect.equals(0, result.exitCode); |
| 33 tempDir.deleteSync(recursive: true); | 33 tempDir.deleteSync(recursive: true); |
| 34 asyncEnd(); | 34 asyncEnd(); |
| 35 }); | 35 }); |
| 36 } | 36 } |
| OLD | NEW |