| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 ]; |
| 11 var script = 'tests/standalone/io/ln.sh'; | 11 var script = 'tests/standalone/io/ln.sh'; |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 } | 97 } |
| 98 | 98 |
| 99 | 99 |
| 100 testFileWriteRead() { | 100 testFileWriteRead() { |
| 101 var temp = new Directory('').createTempSync(); | 101 var temp = new Directory('').createTempSync(); |
| 102 var x = '${temp.path}${Platform.pathSeparator}x'; | 102 var x = '${temp.path}${Platform.pathSeparator}x'; |
| 103 var y = '${temp.path}${Platform.pathSeparator}y'; | 103 var y = '${temp.path}${Platform.pathSeparator}y'; |
| 104 new File(x).createSync(); | 104 new File(x).createSync(); |
| 105 createLink(x, y, true, () { | 105 createLink(x, y, true, () { |
| 106 var data = "asdf".codeUnits; | 106 var data = "asdf".codeUnits; |
| 107 var output = new File(y).openWrite(FileMode.WRITE); | 107 var output = new File(y).openWrite(mode: FileMode.WRITE); |
| 108 output.add(data); | 108 output.writeBytes(data); |
| 109 output.close(); | 109 output.close(); |
| 110 output.done.then((_) { | 110 output.done.then((_) { |
| 111 var read = new File(y).readAsBytesSync(); | 111 var read = new File(y).readAsBytesSync(); |
| 112 Expect.listEquals(data, read); | 112 Expect.listEquals(data, read); |
| 113 var read2 = new File(x).readAsBytesSync(); | 113 var read2 = new File(x).readAsBytesSync(); |
| 114 Expect.listEquals(data, read2); | 114 Expect.listEquals(data, read2); |
| 115 temp.deleteSync(recursive: true); | 115 temp.deleteSync(recursive: true); |
| 116 }); | 116 }); |
| 117 }); | 117 }); |
| 118 } | 118 } |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 | 241 |
| 242 main() { | 242 main() { |
| 243 testFileExistsCreate(); | 243 testFileExistsCreate(); |
| 244 testFileDelete(); | 244 testFileDelete(); |
| 245 testFileWriteRead(); | 245 testFileWriteRead(); |
| 246 testDirectoryExistsCreate(); | 246 testDirectoryExistsCreate(); |
| 247 testDirectoryDelete(); | 247 testDirectoryDelete(); |
| 248 testDirectoryListing(); | 248 testDirectoryListing(); |
| 249 testDirectoryListingBrokenLink(); | 249 testDirectoryListingBrokenLink(); |
| 250 } | 250 } |
| OLD | NEW |