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

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

Issue 15832003: Change File.directory to not do any IO (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 6 months 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
« no previous file with comments | « tests/standalone/io/file_fuzz_test.dart ('k') | tests/standalone/io/file_non_ascii_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "package:expect/expect.dart"; 5 import "package:expect/expect.dart";
6 import 'dart:io'; 6 import 'dart:io';
7 7
8 main() { 8 main() {
9 Directory tempDir = new Directory('').createTempSync(); 9 Directory tempDir = new Directory('').createTempSync();
10 Directory nonAsciiDir = new Directory('${tempDir.path}/æøå'); 10 Directory nonAsciiDir = new Directory('${tempDir.path}/æøå');
11 nonAsciiDir.createSync(); 11 nonAsciiDir.createSync();
12 Expect.isTrue(nonAsciiDir.existsSync()); 12 Expect.isTrue(nonAsciiDir.existsSync());
13 File nonAsciiFile = new File('${nonAsciiDir.path}/æøå.txt'); 13 File nonAsciiFile = new File('${nonAsciiDir.path}/æøå.txt');
14 nonAsciiFile.writeAsStringSync('æøå'); 14 nonAsciiFile.writeAsStringSync('æøå');
15 Expect.isTrue(nonAsciiFile.existsSync()); 15 Expect.isTrue(nonAsciiFile.existsSync());
16 // On MacOS you get the decomposed utf8 form of file and directory 16 // On MacOS you get the decomposed utf8 form of file and directory
17 // names from the system. Therefore, we have to check for both here. 17 // names from the system. Therefore, we have to check for both here.
18 var precomposed = 'æøå'; 18 var precomposed = 'æøå';
19 var decomposed = new String.fromCharCodes([47, 230, 248, 97, 778]); 19 var decomposed = new String.fromCharCodes([47, 230, 248, 97, 778]);
20 // The contents of the file is precomposed utf8. 20 // The contents of the file is precomposed utf8.
21 Expect.equals(precomposed, nonAsciiFile.readAsStringSync()); 21 Expect.equals(precomposed, nonAsciiFile.readAsStringSync());
22 nonAsciiFile.createSync(); 22 nonAsciiFile.createSync();
23 var path = nonAsciiFile.directorySync().path; 23 var path = nonAsciiFile.directory.path;
24 Expect.isTrue(path.endsWith(precomposed) || path.endsWith(decomposed)); 24 Expect.isTrue(path.endsWith(precomposed) || path.endsWith(decomposed));
25 Expect.equals(6, nonAsciiFile.lengthSync()); 25 Expect.equals(6, nonAsciiFile.lengthSync());
26 nonAsciiFile.lastModifiedSync(); 26 nonAsciiFile.lastModifiedSync();
27 path = nonAsciiFile.fullPathSync(); 27 path = nonAsciiFile.fullPathSync();
28 Expect.isTrue(path.endsWith('${precomposed}.txt') || 28 Expect.isTrue(path.endsWith('${precomposed}.txt') ||
29 path.endsWith('${decomposed}.txt')); 29 path.endsWith('${decomposed}.txt'));
30 tempDir.deleteSync(recursive: true); 30 tempDir.deleteSync(recursive: true);
31 } 31 }
OLDNEW
« no previous file with comments | « tests/standalone/io/file_fuzz_test.dart ('k') | tests/standalone/io/file_non_ascii_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698