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

Side by Side Diff: test/request_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 | « pubspec.yaml ('k') | test/response_test.dart » ('j') | 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.request_test; 5 library shelf.request_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'; 10 import 'package:shelf/shelf.dart';
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 }); 271 });
272 272
273 test("throws if path isn't a path boundary", () { 273 test("throws if path isn't a path boundary", () {
274 var uri = Uri.parse('https://test.example.com/static/dir/file.html'); 274 var uri = Uri.parse('https://test.example.com/static/dir/file.html');
275 var request = new Request('GET', uri, 275 var request = new Request('GET', uri,
276 handlerPath: '/static/', url: Uri.parse('dir/file.html')); 276 handlerPath: '/static/', url: Uri.parse('dir/file.html'));
277 277
278 expect(() => request.change(path: 'di'), throwsArgumentError); 278 expect(() => request.change(path: 'di'), throwsArgumentError);
279 }); 279 });
280 }); 280 });
281
282 test("allows the original request to be read", () {
283 var request = _request();
284 var changed = request.change();
285
286 expect(request.read().toList(), completion(isEmpty));
287 expect(changed.read, throwsStateError);
288 });
289
290 test("allows the changed request to be read", () {
291 var request = _request();
292 var changed = request.change();
293
294 expect(changed.read().toList(), completion(isEmpty));
295 expect(request.read, throwsStateError);
296 });
297
298 test("allows another changed request to be read", () {
299 var request = _request();
300 var changed1 = request.change();
301 var changed2 = request.change();
302
303 expect(changed2.read().toList(), completion(isEmpty));
304 expect(changed1.read, throwsStateError);
305 expect(request.read, throwsStateError);
306 });
281 }); 307 });
282 } 308 }
OLDNEW
« no previous file with comments | « pubspec.yaml ('k') | test/response_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698