Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(475)

Side by Side Diff: tests/standalone/io/file_non_ascii_test.dart

Issue 11316077: Remove non-ascii file names from repo and generate them in tests instead. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove last file Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 import 'dart:isolate'; 6 import 'dart:isolate';
7 7
8 main() { 8 main() {
9 var port = new ReceivePort(); 9 ReceivePort port = new ReceivePort();
10 Directory scriptDir = new File(new Options().script).directorySync(); 10
11 var f = new File("${scriptDir.path}/æøå/æøå.dat");
12 // On MacOS you get the decomposed utf8 form of file and directory 11 // 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. 12 // names from the system. Therefore, we have to check for both here.
14 var precomposed = 'æøå'; 13 var precomposed = 'æøå';
15 var decomposed = new String.fromCharCodes([47, 230, 248, 97, 778]); 14 var decomposed = new String.fromCharCodes([47, 230, 248, 97, 778]);
16 f.exists().then((e) { 15
17 Expect.isTrue(e); 16 new Directory('').createTemp().then((tempDir) {
18 f.create().then((_) { 17 Directory nonAsciiDir = new Directory('${tempDir.path}/æøå');
19 f.directory().then((d) { 18 nonAsciiDir.create().then((nonAsciiDir) {
20 Expect.isTrue(d.path.endsWith(precomposed) || 19 nonAsciiDir.exists().then((result) {
21 d.path.endsWith(decomposed)); 20 Expect.isTrue(result);
22 f.length().then((l) { 21 File nonAsciiFile = new File('${nonAsciiDir.path}/æøå.txt');
23 Expect.equals(6, l); 22 nonAsciiFile.open(FileMode.WRITE).then((opened) {
24 f.lastModified().then((_) { 23 opened.writeString('æøå').then((_) {
25 f.fullPath().then((p) { 24 opened.close().then((_) {
26 Expect.isTrue(p.endsWith('${precomposed}.dat') || 25 nonAsciiFile.exists().then((result) {
27 p.endsWith('${decomposed}.dat')); 26 Expect.isTrue(result);
28 f.readAsString().then((contents) { 27 nonAsciiFile.readAsString().then((contents) {
29 Expect.equals(precomposed, contents); 28 // The contents of the file is precomposed utf8.
30 port.close(); 29 Expect.equals(precomposed, contents);
30 nonAsciiFile.create().then((_) {
31 nonAsciiFile.directory().then((d) {
32 Expect.isTrue(d.path.endsWith(precomposed) ||
33 d.path.endsWith(decomposed));
34 nonAsciiFile.length().then((l) {
ricow1 2012/11/19 12:20:54 l -> length?
Mads Ager (google) 2012/11/19 12:26:20 Done.
35 Expect.equals(6, l);
36 nonAsciiFile.lastModified().then((_) {
37 nonAsciiFile.fullPath().then((path) {
38 Expect.isTrue(path.endsWith('${precomposed}.txt') ||
39 path.endsWith('${decomposed}.txt'));
40 tempDir.delete(recursive: true).then((_) {
41 port.close();
42 });
43 });
44 });
45 });
46 });
47 });
48 });
31 }); 49 });
32 }); 50 });
33 }); 51 });
34 }); 52 });
35 }); 53 });
36 }); 54 });
37 }); 55 });
38 } 56 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698