| 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'; |
| 6 |
| 7 import "package:async_helper/async_helper.dart"; |
| 5 import "package:expect/expect.dart"; | 8 import "package:expect/expect.dart"; |
| 6 import 'dart:io'; | |
| 7 import 'dart:isolate'; | |
| 8 | 9 |
| 9 main() { | 10 main() { |
| 10 var port = new ReceivePort(); | 11 asyncStart(); |
| 11 | 12 |
| 12 // On MacOS you get the decomposed utf8 form of file and directory | 13 // On MacOS you get the decomposed utf8 form of file and directory |
| 13 // names from the system. Therefore, we have to check for both here. | 14 // names from the system. Therefore, we have to check for both here. |
| 14 var precomposed = 'æøå'; | 15 var precomposed = 'æøå'; |
| 15 var decomposed = new String.fromCharCodes([47, 230, 248, 97, 778]); | 16 var decomposed = new String.fromCharCodes([47, 230, 248, 97, 778]); |
| 16 | 17 |
| 17 new Directory('').createTemp().then((tempDir) { | 18 new Directory('').createTemp().then((tempDir) { |
| 18 var nonAsciiDir = new Directory("${tempDir.path}/æøå"); | 19 var nonAsciiDir = new Directory("${tempDir.path}/æøå"); |
| 19 nonAsciiDir.exists().then((e) { | 20 nonAsciiDir.exists().then((e) { |
| 20 Expect.isFalse(e); | 21 Expect.isFalse(e); |
| 21 nonAsciiDir.create().then((_) { | 22 nonAsciiDir.create().then((_) { |
| 22 nonAsciiDir.exists().then((e) { | 23 nonAsciiDir.exists().then((e) { |
| 23 Expect.isTrue(e); | 24 Expect.isTrue(e); |
| 24 new Directory("${tempDir.path}/æøå").createTemp().then((temp) { | 25 new Directory("${tempDir.path}/æøå").createTemp().then((temp) { |
| 25 Expect.isTrue(temp.path.contains(precomposed) || | 26 Expect.isTrue(temp.path.contains(precomposed) || |
| 26 temp.path.contains(decomposed)); | 27 temp.path.contains(decomposed)); |
| 27 temp.delete().then((_) { | 28 temp.delete().then((_) { |
| 28 tempDir.delete(recursive: true).then((_) { | 29 tempDir.delete(recursive: true).then((_) { |
| 29 Expect.isFalse(temp.existsSync()); | 30 Expect.isFalse(temp.existsSync()); |
| 30 Expect.isFalse(nonAsciiDir.existsSync()); | 31 Expect.isFalse(nonAsciiDir.existsSync()); |
| 31 port.close(); | 32 asyncEnd(); |
| 32 }); | 33 }); |
| 33 }); | 34 }); |
| 34 }); | 35 }); |
| 35 }); | 36 }); |
| 36 }); | 37 }); |
| 37 }); | 38 }); |
| 38 }); | 39 }); |
| 39 } | 40 } |
| OLD | NEW |