| 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".codeUnits; |
| 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.deleteSync(recursive: true); | 77 temp.deleteSync(recursive: true); |
| 78 }; | 78 }; |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 | 189 |
| 190 main() { | 190 main() { |
| 191 testFileExistsCreate(); | 191 testFileExistsCreate(); |
| 192 testFileDelete(); | 192 testFileDelete(); |
| 193 testFileWriteRead(); | 193 testFileWriteRead(); |
| 194 testDirectoryExistsCreate(); | 194 testDirectoryExistsCreate(); |
| 195 testDirectoryDelete(); | 195 testDirectoryDelete(); |
| 196 testDirectoryListing(); | 196 testDirectoryListing(); |
| 197 testDirectoryListingBrokenLink(); | 197 testDirectoryListingBrokenLink(); |
| 198 } | 198 } |
| OLD | NEW |