| 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 // Testing file input stream, VM-only, standalone test. | 4 // Testing file input stream, VM-only, standalone test. |
| 5 | 5 |
| 6 import "dart:convert"; | 6 import "dart:convert"; |
| 7 import "dart:io"; | 7 import "dart:io"; |
| 8 | 8 |
| 9 import "package:async_helper/async_helper.dart"; | 9 import "package:async_helper/async_helper.dart"; |
| 10 import "package:expect/expect.dart"; | 10 import "package:expect/expect.dart"; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 asyncEnd(); | 48 asyncEnd(); |
| 49 }); | 49 }); |
| 50 } | 50 } |
| 51 | 51 |
| 52 | 52 |
| 53 // Create a file that is big enough that a file stream will | 53 // Create a file that is big enough that a file stream will |
| 54 // read it in multiple chunks. | 54 // read it in multiple chunks. |
| 55 int writeLongFileSync(File file) { | 55 int writeLongFileSync(File file) { |
| 56 file.createSync(); | 56 file.createSync(); |
| 57 StringBuffer buffer = new StringBuffer(); | 57 StringBuffer buffer = new StringBuffer(); |
| 58 for (var i = 0; i < 10000; i++) { | 58 for (var i = 0; i < 50000; i++) { |
| 59 buffer.write("Hello, world"); | 59 buffer.write("Hello, world"); |
| 60 } | 60 } |
| 61 file.writeAsStringSync(buffer.toString()); | 61 file.writeAsStringSync(buffer.toString()); |
| 62 var length = file.lengthSync(); | 62 var length = file.lengthSync(); |
| 63 Expect.equals(buffer.length, length); | 63 Expect.equals(buffer.length, length); |
| 64 return length; | 64 return length; |
| 65 } | 65 } |
| 66 | 66 |
| 67 | 67 |
| 68 void testInputStreamTruncate() { | 68 void testInputStreamTruncate() { |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 testInputStreamDelete(); | 256 testInputStreamDelete(); |
| 257 testInputStreamAppend(); | 257 testInputStreamAppend(); |
| 258 testInputStreamOffset(); | 258 testInputStreamOffset(); |
| 259 testInputStreamBadOffset(); | 259 testInputStreamBadOffset(); |
| 260 // Check the length of these files as both are text files where one | 260 // Check the length of these files as both are text files where one |
| 261 // is without a terminating line separator which can easily be added | 261 // is without a terminating line separator which can easily be added |
| 262 // back if accidentally opened in a text editor. | 262 // back if accidentally opened in a text editor. |
| 263 testStringLineSplitterEnding("readline_test1.dat", 111); | 263 testStringLineSplitterEnding("readline_test1.dat", 111); |
| 264 testStringLineSplitterEnding("readline_test2.dat", 114); | 264 testStringLineSplitterEnding("readline_test2.dat", 114); |
| 265 } | 265 } |
| OLD | NEW |