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 | 7 |
8 createLink(String dst, String link, bool symbolic, void callback()) { | 8 createLink(String dst, String link, bool symbolic, void callback()) { |
9 var args = [ symbolic ? '-s' : '', dst, link ]; | 9 var args = [ symbolic ? '-s' : '', dst, link ]; |
10 var script = 'tests/standalone/io/ln.sh'; | 10 var script = 'tests/standalone/io/ln.sh'; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 }); | 58 }); |
59 } | 59 } |
60 | 60 |
61 | 61 |
62 testFileWriteRead() { | 62 testFileWriteRead() { |
63 var temp = new Directory('').createTempSync(); | 63 var temp = new Directory('').createTempSync(); |
64 var x = '${temp.path}${Platform.pathSeparator}x'; | 64 var x = '${temp.path}${Platform.pathSeparator}x'; |
65 var y = '${temp.path}${Platform.pathSeparator}y'; | 65 var y = '${temp.path}${Platform.pathSeparator}y'; |
66 new File(x).createSync(); | 66 new File(x).createSync(); |
67 createLink(x, y, true, () { | 67 createLink(x, y, true, () { |
68 var data = "asdf".charCodes(); | 68 var data = "asdf".charCodes; |
69 var output = new File(y).openOutputStream(FileMode.WRITE); | 69 var output = new File(y).openOutputStream(FileMode.WRITE); |
70 output.write(data); | 70 output.write(data); |
71 output.onNoPendingWrites = () { | 71 output.onNoPendingWrites = () { |
72 output.close(); | 72 output.close(); |
73 var read = new File(y).readAsBytesSync(); | 73 var read = new File(y).readAsBytesSync(); |
74 Expect.listEquals(data, read); | 74 Expect.listEquals(data, read); |
75 var read2 = new File(x).readAsBytesSync(); | 75 var read2 = new File(x).readAsBytesSync(); |
76 Expect.listEquals(data, read2); | 76 Expect.listEquals(data, read2); |
77 temp.deleteRecursivelySync(); | 77 temp.deleteRecursivelySync(); |
78 }; | 78 }; |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 | 172 |
173 main() { | 173 main() { |
174 testFileExistsCreate(); | 174 testFileExistsCreate(); |
175 testFileDelete(); | 175 testFileDelete(); |
176 testFileWriteRead(); | 176 testFileWriteRead(); |
177 testDirectoryExistsCreate(); | 177 testDirectoryExistsCreate(); |
178 testDirectoryDelete(); | 178 testDirectoryDelete(); |
179 testDirectoryListing(); | 179 testDirectoryListing(); |
180 testDirectoryListingBrokenLink(); | 180 testDirectoryListingBrokenLink(); |
181 } | 181 } |
OLD | NEW |