| OLD | NEW |
| 1 // Copyright (c) 2013, 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 "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
| 6 import "dart:io"; | 6 import "dart:io"; |
| 7 import "dart:isolate"; | 7 import "dart:isolate"; |
| 8 | 8 |
| 9 | 9 |
| 10 createLink(String dst, String link, void callback()) { | 10 createLink(String dst, String link, void callback()) { |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 | 94 |
| 95 | 95 |
| 96 testFileWriteRead() { | 96 testFileWriteRead() { |
| 97 var temp = new Directory('').createTempSync(); | 97 var temp = new Directory('').createTempSync(); |
| 98 var x = '${temp.path}${Platform.pathSeparator}x'; | 98 var x = '${temp.path}${Platform.pathSeparator}x'; |
| 99 var y = '${temp.path}${Platform.pathSeparator}y'; | 99 var y = '${temp.path}${Platform.pathSeparator}y'; |
| 100 new File(x).createSync(); | 100 new File(x).createSync(); |
| 101 createLink(x, y, () { | 101 createLink(x, y, () { |
| 102 var data = "asdf".codeUnits; | 102 var data = "asdf".codeUnits; |
| 103 var output = new File(y).openWrite(mode: FileMode.WRITE); | 103 var output = new File(y).openWrite(mode: FileMode.WRITE); |
| 104 output.writeBytes(data); | 104 output.add(data); |
| 105 output.close(); | 105 output.close(); |
| 106 output.done.then((_) { | 106 output.done.then((_) { |
| 107 var read = new File(y).readAsBytesSync(); | 107 var read = new File(y).readAsBytesSync(); |
| 108 Expect.listEquals(data, read); | 108 Expect.listEquals(data, read); |
| 109 var read2 = new File(x).readAsBytesSync(); | 109 var read2 = new File(x).readAsBytesSync(); |
| 110 Expect.listEquals(data, read2); | 110 Expect.listEquals(data, read2); |
| 111 temp.deleteSync(recursive: true); | 111 temp.deleteSync(recursive: true); |
| 112 }); | 112 }); |
| 113 }); | 113 }); |
| 114 } | 114 } |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 | 240 |
| 241 main() { | 241 main() { |
| 242 testFileExistsCreate(); | 242 testFileExistsCreate(); |
| 243 testFileDelete(); | 243 testFileDelete(); |
| 244 testFileWriteRead(); | 244 testFileWriteRead(); |
| 245 testDirectoryExistsCreate(); | 245 testDirectoryExistsCreate(); |
| 246 testDirectoryDelete(); | 246 testDirectoryDelete(); |
| 247 testDirectoryListing(); | 247 testDirectoryListing(); |
| 248 testDirectoryListingBrokenLink(); | 248 testDirectoryListingBrokenLink(); |
| 249 } | 249 } |
| OLD | NEW |