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

Side by Side Diff: test/response_test.dart

Issue 1327453002: Share a body across all versions of a message. (Closed) Base URL: git@github.com:dart-lang/shelf@master
Patch Set: Code review changes Created 5 years, 3 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 unified diff | Download patch
« no previous file with comments | « test/request_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 library shelf.response_test; 5 library shelf.response_test;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:convert'; 8 import 'dart:convert';
9 9
10 import 'package:shelf/shelf.dart' hide Request; 10 import 'package:shelf/shelf.dart' hide Request;
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 expect(copy.encoding, request.encoding); 105 expect(copy.encoding, request.encoding);
106 expect(copy.context, same(request.context)); 106 expect(copy.context, same(request.context));
107 107
108 controller.add(HELLO_BYTES); 108 controller.add(HELLO_BYTES);
109 return new Future(() { 109 return new Future(() {
110 controller 110 controller
111 ..add(WORLD_BYTES) 111 ..add(WORLD_BYTES)
112 ..close(); 112 ..close();
113 }); 113 });
114 }); 114 });
115
116
117 test("allows the original response to be read", () {
118 var response = new Response.ok(null);
119 var changed = response.change();
120
121 expect(response.read().toList(), completion(isEmpty));
122 expect(changed.read, throwsStateError);
123 });
124
125 test("allows the changed response to be read", () {
126 var response = new Response.ok(null);
127 var changed = response.change();
128
129 expect(changed.read().toList(), completion(isEmpty));
130 expect(response.read, throwsStateError);
131 });
132
133 test("allows another changed response to be read", () {
134 var response = new Response.ok(null);
135 var changed1 = response.change();
136 var changed2 = response.change();
137
138 expect(changed2.read().toList(), completion(isEmpty));
139 expect(changed1.read, throwsStateError);
140 expect(response.read, throwsStateError);
141 });
115 }); 142 });
116 } 143 }
OLDNEW
« no previous file with comments | « test/request_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698