| 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 import "dart:isolate"; | 6 import "dart:isolate"; |
| 7 | 7 |
| 8 | 8 |
| 9 createLink(String dst, String link, bool symbolic, void callback()) { | 9 createLink(String dst, String link, bool symbolic, void callback()) { |
| 10 var args = [ symbolic ? '-s' : '', dst, link ]; | 10 var args = [ symbolic ? '-s' : '', dst, link ]; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 }); | 59 }); |
| 60 } | 60 } |
| 61 | 61 |
| 62 | 62 |
| 63 testFileWriteRead() { | 63 testFileWriteRead() { |
| 64 var temp = new Directory('').createTempSync(); | 64 var temp = new Directory('').createTempSync(); |
| 65 var x = '${temp.path}${Platform.pathSeparator}x'; | 65 var x = '${temp.path}${Platform.pathSeparator}x'; |
| 66 var y = '${temp.path}${Platform.pathSeparator}y'; | 66 var y = '${temp.path}${Platform.pathSeparator}y'; |
| 67 new File(x).createSync(); | 67 new File(x).createSync(); |
| 68 createLink(x, y, true, () { | 68 createLink(x, y, true, () { |
| 69 var data = "asdf".charCodes; | 69 var data = "asdf".codeUnits; |
| 70 var output = new File(y).openWrite(FileMode.WRITE); | 70 var output = new File(y).openWrite(FileMode.WRITE); |
| 71 output.add(data); | 71 output.add(data); |
| 72 output.close(); | 72 output.close(); |
| 73 output.done.then((_) { | 73 output.done.then((_) { |
| 74 var read = new File(y).readAsBytesSync(); | 74 var read = new File(y).readAsBytesSync(); |
| 75 Expect.listEquals(data, read); | 75 Expect.listEquals(data, read); |
| 76 var read2 = new File(x).readAsBytesSync(); | 76 var read2 = new File(x).readAsBytesSync(); |
| 77 Expect.listEquals(data, read2); | 77 Expect.listEquals(data, read2); |
| 78 temp.deleteSync(recursive: true); | 78 temp.deleteSync(recursive: true); |
| 79 }); | 79 }); |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 | 204 |
| 205 main() { | 205 main() { |
| 206 testFileExistsCreate(); | 206 testFileExistsCreate(); |
| 207 testFileDelete(); | 207 testFileDelete(); |
| 208 testFileWriteRead(); | 208 testFileWriteRead(); |
| 209 testDirectoryExistsCreate(); | 209 testDirectoryExistsCreate(); |
| 210 testDirectoryDelete(); | 210 testDirectoryDelete(); |
| 211 testDirectoryListing(); | 211 testDirectoryListing(); |
| 212 testDirectoryListingBrokenLink(); | 212 testDirectoryListingBrokenLink(); |
| 213 } | 213 } |
| OLD | NEW |