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

Side by Side Diff: dart/pkg/http_base/test/http_base_test.dart

Issue 495533003: Remove obsolete http_base package (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « dart/pkg/http_base/test/http_base_io_test.dart ('k') | dart/pkg/pkg.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 library http_base.http_base_test;
2
3 import 'package:http_base/http_base.dart';
4 import 'package:unittest/unittest.dart';
5
6 main() {
7 group('headers-impl', () {
8 test('empty', () {
9 for (HeadersImpl emptyHeaders in [HeadersImpl.Empty,
10 new HeadersImpl({})]) {
11 expect(emptyHeaders.names, isEmpty);
12 expect(emptyHeaders['foo'], isNull);
13 expect(emptyHeaders.getMultiple('foo'), isNull);
14 }
15 });
16
17 test('multi-value', () {
18 var headers = new HeadersImpl({
19 'Single' : 'single-value',
20 'Mul' : ['mul-1', 'mul-2', 'mul-3,mul-4'],
21 'Mul-Inline' : 'mi-1,mi-2,mi-3',
22 });
23
24 expect(headers.names, hasLength(3));
25 expect(headers.names, contains('single'));
26 expect(headers.names, contains('mul'));
27 expect(headers.names, contains('mul-inline'));
28
29 for (var key in ['Single', 'single']) {
30 expect(headers[key], equals('single-value'));
31 expect(headers.getMultiple(key), equals(['single-value']));
32 }
33
34 for (var key in ['Mul', 'mul']) {
35 expect(headers[key], equals('mul-1,mul-2,mul-3,mul-4'));
36 expect(headers.getMultiple(key),
37 equals(['mul-1','mul-2','mul-3','mul-4']));
38 }
39
40 for (var key in ['Mul-Inline', 'mul-inline']) {
41 expect(headers[key], equals('mi-1,mi-2,mi-3'));
42 expect(headers.getMultiple(key), equals(['mi-1','mi-2','mi-3']));
43 }
44 });
45
46 test('cookie-headers', () {
47 var headers = new HeadersImpl({
48 'Set-Cookie' : [
49 'lang=en-US; Expires=Wed, 09 Jun 2021 10:18:14 GMT',
50 'lang=de-DE; Expires=Wed, 09 Jun 2021 10:18:14 GMT',],
51 'Cookie' : ['name1=value1; name2=value2', 'name3=value3'],
52 });
53
54 expect(() => headers['set-cookie'], throwsArgumentError);
55 expect(() => headers['cookie'], throwsArgumentError);
56
57 expect(headers.getMultiple('set-cookie').toList(), equals([
58 'lang=en-US; Expires=Wed, 09 Jun 2021 10:18:14 GMT',
59 'lang=de-DE; Expires=Wed, 09 Jun 2021 10:18:14 GMT']));
60
61 expect(headers.getMultiple('cookie').toList(),
62 equals(['name1=value1; name2=value2', 'name3=value3']));
63 });
64
65 test('replace', () {
66 var headers = new HeadersImpl({
67 'Single' : 'single-value',
68 'Mul' : ['mul-1', 'mul-2', 'mul-3,mul-4'],
69 'Mul-Inline' : 'mi-1,mi-2,mi-3',
70 }).replace({
71 'single' : 'foo',
72 'mul' : null,
73 'mul-inline' : 'bar',
74 });
75
76 expect(headers.names, hasLength(2));
77 expect(headers['single'], equals('foo'));
78 expect(headers['mul-inline'], equals('bar'));
79 });
80 });
81 }
OLDNEW
« no previous file with comments | « dart/pkg/http_base/test/http_base_io_test.dart ('k') | dart/pkg/pkg.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698