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

Unified Diff: dart/pkg/shelf/test/message_test.dart

Issue 342323004: Throw a StateError if read()/readAsString() is called multiple times (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 6 months 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 | « dart/pkg/shelf/lib/src/message.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/pkg/shelf/test/message_test.dart
diff --git a/dart/pkg/shelf/test/message_test.dart b/dart/pkg/shelf/test/message_test.dart
index d393388e8d96589327f40bab7fad6e2469201b26..1d8411028cb1dd465dc3bcd510de4419e0014442 100644
--- a/dart/pkg/shelf/test/message_test.dart
+++ b/dart/pkg/shelf/test/message_test.dart
@@ -131,6 +131,26 @@ void main() {
..close();
});
});
+
+ test("throws when calling read()/readAsString() multiple times", () {
+ var request;
+
+ request = _createMessage();
+ expect(request.read().toList(), completion(isEmpty));
+ expect(() => request.read(), throwsStateError);
+
+ request = _createMessage();
+ expect(request.readAsString(), completion(isEmpty));
+ expect(() => request.readAsString(), throwsStateError);
+
+ request = _createMessage();
+ expect(request.readAsString(), completion(isEmpty));
+ expect(() => request.read(), throwsStateError);
+
+ request = _createMessage();
+ expect(request.read().toList(), completion(isEmpty));
+ expect(() => request.readAsString(), throwsStateError);
+ });
});
group("contentLength", () {
« no previous file with comments | « dart/pkg/shelf/lib/src/message.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698