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

Side by Side Diff: tests/standalone/io/url_encoding_test.dart

Issue 11358024: Changes outside pkg/ and lib/ for directory refactoring (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 1 month 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
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 #import("dart:utf"); 5 import "dart:utf";
6 #source("../../../lib/io/input_stream.dart"); 6 part "../../../sdk/lib/io/input_stream.dart";
7 #source("../../../lib/io/output_stream.dart"); 7 part "../../../sdk/lib/io/output_stream.dart";
8 #source("../../../lib/io/chunked_stream.dart"); 8 part "../../../sdk/lib/io/chunked_stream.dart";
9 #source("../../../lib/io/string_stream.dart"); 9 part "../../../sdk/lib/io/string_stream.dart";
10 #source("../../../lib/io/stream_util.dart"); 10 part "../../../sdk/lib/io/stream_util.dart";
11 #source("../../../lib/io/http.dart"); 11 part "../../../sdk/lib/io/http.dart";
12 #source("../../../lib/io/http_impl.dart"); 12 part "../../../sdk/lib/io/http_impl.dart";
13 #source("../../../lib/io/http_parser.dart"); 13 part "../../../sdk/lib/io/http_parser.dart";
14 #source("../../../lib/io/http_utils.dart"); 14 part "../../../sdk/lib/io/http_utils.dart";
15 15
16 void testParseEncodedString() { 16 void testParseEncodedString() {
17 String encodedString = 'foo+bar%20foobar%25%26'; 17 String encodedString = 'foo+bar%20foobar%25%26';
18 Expect.equals(_HttpUtils.decodeUrlEncodedString(encodedString), 18 Expect.equals(_HttpUtils.decodeUrlEncodedString(encodedString),
19 'foo bar foobar%&'); 19 'foo bar foobar%&');
20 } 20 }
21 21
22 void testParseQueryString() { 22 void testParseQueryString() {
23 // The query string includes escaped "?"s, "&"s, "%"s and "="s. 23 // The query string includes escaped "?"s, "&"s, "%"s and "="s.
24 // These should not affect the splitting of the string. 24 // These should not affect the splitting of the string.
25 String queryString = 25 String queryString =
26 '%3F=%3D&foo=bar&%26=%25&sqrt2=%E2%88%9A2&name=Franti%C5%A1ek'; 26 '%3F=%3D&foo=bar&%26=%25&sqrt2=%E2%88%9A2&name=Franti%C5%A1ek';
27 Map<String, String> map = _HttpUtils.splitQueryString(queryString); 27 Map<String, String> map = _HttpUtils.splitQueryString(queryString);
28 for (String key in map.keys) { 28 for (String key in map.keys) {
29 Expect.equals(map[key], { '&' : '%', 29 Expect.equals(map[key], { '&' : '%',
30 'foo' : 'bar', 30 'foo' : 'bar',
31 '?' : '=', 31 '?' : '=',
32 'sqrt2' : '\u221A2', 32 'sqrt2' : '\u221A2',
33 'name' : 'Franti\u0161ek'}[key]); 33 'name' : 'Franti\u0161ek'}[key]);
34 } 34 }
35 Expect.setEquals(map.keys, ['&', '?', 'foo', 'sqrt2', 'name']); 35 Expect.setEquals(map.keys, ['&', '?', 'foo', 'sqrt2', 'name']);
36 } 36 }
37 37
38 void main() { 38 void main() {
39 testParseEncodedString(); 39 testParseEncodedString();
40 testParseQueryString(); 40 testParseQueryString();
41 } 41 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698