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() { |
(...skipping 10 matching lines...) Expand all Loading... |
21 nonAsciiDir.exists().then((result) { | 21 nonAsciiDir.exists().then((result) { |
22 Expect.isTrue(result); | 22 Expect.isTrue(result); |
23 File nonAsciiFile = new File('${nonAsciiDir.path}/æøå.txt'); | 23 File nonAsciiFile = new File('${nonAsciiDir.path}/æøå.txt'); |
24 nonAsciiFile.writeAsString('æøå').then((_) { | 24 nonAsciiFile.writeAsString('æøå').then((_) { |
25 nonAsciiFile.exists().then((result) { | 25 nonAsciiFile.exists().then((result) { |
26 Expect.isTrue(result); | 26 Expect.isTrue(result); |
27 nonAsciiFile.readAsString().then((contents) { | 27 nonAsciiFile.readAsString().then((contents) { |
28 // The contents of the file is precomposed utf8. | 28 // The contents of the file is precomposed utf8. |
29 Expect.equals(precomposed, contents); | 29 Expect.equals(precomposed, contents); |
30 nonAsciiFile.create().then((_) { | 30 nonAsciiFile.create().then((_) { |
31 var d = nonAsciiFile.directory; | 31 var d = nonAsciiFile.parent; |
32 Expect.isTrue(d.path.endsWith(precomposed) || | 32 Expect.isTrue(d.path.endsWith(precomposed) || |
33 d.path.endsWith(decomposed)); | 33 d.path.endsWith(decomposed)); |
34 nonAsciiFile.length().then((length) { | 34 nonAsciiFile.length().then((length) { |
35 Expect.equals(6, length); | 35 Expect.equals(6, length); |
36 nonAsciiFile.lastModified().then((_) { | 36 nonAsciiFile.lastModified().then((_) { |
37 nonAsciiFile.fullPath().then((path) { | 37 nonAsciiFile.resolveSymbolicLinks().then((path) { |
38 Expect.isTrue(path.endsWith('${precomposed}.txt') || | 38 Expect.isTrue(path.endsWith('${precomposed}.txt') || |
39 path.endsWith('${decomposed}.txt')); | 39 path.endsWith('${decomposed}.txt')); |
40 tempDir.delete(recursive: true).then((_) { | 40 tempDir.delete(recursive: true).then((_) { |
41 asyncEnd(); | 41 asyncEnd(); |
42 }); | 42 }); |
43 }); | 43 }); |
44 }); | 44 }); |
45 }); | 45 }); |
46 }); | 46 }); |
47 }); | 47 }); |
48 }); | 48 }); |
49 }); | 49 }); |
50 }); | 50 }); |
51 }); | 51 }); |
52 }).catchError((e) { | 52 }).catchError((e) { |
53 Expect.fail("File not found"); | 53 Expect.fail("File not found"); |
54 }); | 54 }); |
55 } | 55 } |
OLD | NEW |