Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(106)

Unified Diff: tests/standalone/src/FileInputStreamTest.dart

Issue 8818009: Add chunked input stream (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments from ager@ Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/standalone/src/ChunkedStreamTest.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/src/FileInputStreamTest.dart
diff --git a/tests/standalone/src/FileInputStreamTest.dart b/tests/standalone/src/FileInputStreamTest.dart
index a61ac68987c8100e018226d380ab2d394e9e53f6..af5fea01800560f483226fd903dd40fba54085e7 100644
--- a/tests/standalone/src/FileInputStreamTest.dart
+++ b/tests/standalone/src/FileInputStreamTest.dart
@@ -8,10 +8,10 @@
String getFilename(String path) =>
new File(path).existsSync() ? path : '../' + path;
-main() {
- String fName = getFilename("tests/standalone/src/readuntil_test.dat");
+void testStringInputStream() {
+ String fileName = getFilename("tests/standalone/src/readuntil_test.dat");
// File contains "Hello Dart\nwassup!"
- File file = new File(fName);
+ File file = new File(fileName);
file.openSync();
StringInputStream x = new StringInputStream(file.openInputStream());
String line = x.readLine();
@@ -20,3 +20,27 @@ main() {
line = x.readLine();
Expect.equals("wassup!", line);
}
+
+void testChunkedInputStream() {
+ String fileName = getFilename("tests/standalone/src/readuntil_test.dat");
+ // File contains 19 bytes ("Hello Dart\nwassup!")
+ File file = new File(fileName);
+ file.openSync();
+ ChunkedInputStream x = new ChunkedInputStream(file.openInputStream());
+ x.chunkSize = 9;
+ List<int> chunk = x.read();
+ Expect.equals(9, chunk.length);
+ file.closeSync();
+ x.chunkSize = 5;
+ chunk = x.read();
+ Expect.equals(5, chunk.length);
+ chunk = x.read();
+ Expect.equals(5, chunk.length);
+ chunk = x.read();
+ Expect.equals(null, chunk);
+}
+
+main() {
+ testStringInputStream();
+ testChunkedInputStream();
+}
« no previous file with comments | « tests/standalone/src/ChunkedStreamTest.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698