OLD | NEW |
1 dart_library.library('corelib/uri_http_test', null, /* Imports */[ | 1 dart_library.library('corelib/uri_http_test', null, /* Imports */[ |
2 'dart_sdk', | 2 'dart_sdk', |
3 'expect' | 3 'expect' |
4 ], function load__uri_http_test(exports, dart_sdk, expect) { | 4 ], function load__uri_http_test(exports, dart_sdk, expect) { |
5 'use strict'; | 5 'use strict'; |
6 const core = dart_sdk.core; | 6 const core = dart_sdk.core; |
7 const dart = dart_sdk.dart; | 7 const dart = dart_sdk.dart; |
8 const dartx = dart_sdk.dartx; | 8 const dartx = dart_sdk.dartx; |
9 const expect$ = expect.expect; | 9 const expect$ = expect.expect; |
10 const uri_http_test = Object.create(null); | 10 const uri_http_test = Object.create(null); |
(...skipping 16 matching lines...) Expand all Loading... |
27 check(core.Uri.http("host", "/a/"), "http://host/a/"); | 27 check(core.Uri.http("host", "/a/"), "http://host/a/"); |
28 check(core.Uri.http("host", "a/b"), "http://host/a/b"); | 28 check(core.Uri.http("host", "a/b"), "http://host/a/b"); |
29 check(core.Uri.http("host", "/a/b"), "http://host/a/b"); | 29 check(core.Uri.http("host", "/a/b"), "http://host/a/b"); |
30 check(core.Uri.http("host", "a/b/"), "http://host/a/b/"); | 30 check(core.Uri.http("host", "a/b/"), "http://host/a/b/"); |
31 check(core.Uri.http("host", "/a/b/"), "http://host/a/b/"); | 31 check(core.Uri.http("host", "/a/b/"), "http://host/a/b/"); |
32 check(core.Uri.http("host", "a b"), "http://host/a%20b"); | 32 check(core.Uri.http("host", "a b"), "http://host/a%20b"); |
33 check(core.Uri.http("host", "/a b"), "http://host/a%20b"); | 33 check(core.Uri.http("host", "/a b"), "http://host/a%20b"); |
34 check(core.Uri.http("host", "/a b/"), "http://host/a%20b/"); | 34 check(core.Uri.http("host", "/a b/"), "http://host/a%20b/"); |
35 check(core.Uri.http("host", "/a%2F"), "http://host/a%252F"); | 35 check(core.Uri.http("host", "/a%2F"), "http://host/a%252F"); |
36 check(core.Uri.http("host", "/a%2F/"), "http://host/a%252F/"); | 36 check(core.Uri.http("host", "/a%2F/"), "http://host/a%252F/"); |
37 check(core.Uri.http("host", "/a/b", dart.map({c: "d"})), "http://host/a/b?c=
d"); | 37 check(core.Uri.http("host", "/a/b", dart.map({c: "d"}, core.String, core.Str
ing)), "http://host/a/b?c=d"); |
38 check(core.Uri.http("host", "/a/b", dart.map({"c=": "&d"})), "http://host/a/
b?c%3D=%26d"); | 38 check(core.Uri.http("host", "/a/b", dart.map({"c=": "&d"}, core.String, core
.String)), "http://host/a/b?c%3D=%26d"); |
39 check(core.Uri.http("[::]", "a"), "http://[::]/a"); | 39 check(core.Uri.http("[::]", "a"), "http://[::]/a"); |
40 check(core.Uri.http("[::127.0.0.1]", "a"), "http://[::127.0.0.1]/a"); | 40 check(core.Uri.http("[::127.0.0.1]", "a"), "http://[::127.0.0.1]/a"); |
41 }; | 41 }; |
42 dart.fn(uri_http_test.testHttpUri, VoidTodynamic()); | 42 dart.fn(uri_http_test.testHttpUri, VoidTodynamic()); |
43 uri_http_test.testHttpsUri = function() { | 43 uri_http_test.testHttpsUri = function() { |
44 function check(uri, expected) { | 44 function check(uri, expected) { |
45 expect$.Expect.equals(expected, dart.toString(uri)); | 45 expect$.Expect.equals(expected, dart.toString(uri)); |
46 } | 46 } |
47 dart.fn(check, UriAndStringTovoid()); | 47 dart.fn(check, UriAndStringTovoid()); |
48 check(core.Uri.https("", ""), "https:"); | 48 check(core.Uri.https("", ""), "https:"); |
49 check(core.Uri.https("@:", ""), "https://"); | 49 check(core.Uri.https("@:", ""), "https://"); |
50 check(core.Uri.https("@:8080", ""), "https://:8080"); | 50 check(core.Uri.https("@:8080", ""), "https://:8080"); |
51 check(core.Uri.https("@host:", ""), "https://host"); | 51 check(core.Uri.https("@host:", ""), "https://host"); |
52 check(core.Uri.https("@host:", ""), "https://host"); | 52 check(core.Uri.https("@host:", ""), "https://host"); |
53 check(core.Uri.https("xxx:yyy@host:8080", ""), "https://xxx:yyy@host:8080"); | 53 check(core.Uri.https("xxx:yyy@host:8080", ""), "https://xxx:yyy@host:8080"); |
54 check(core.Uri.https("host", "a"), "https://host/a"); | 54 check(core.Uri.https("host", "a"), "https://host/a"); |
55 check(core.Uri.https("host", "/a"), "https://host/a"); | 55 check(core.Uri.https("host", "/a"), "https://host/a"); |
56 check(core.Uri.https("host", "a/"), "https://host/a/"); | 56 check(core.Uri.https("host", "a/"), "https://host/a/"); |
57 check(core.Uri.https("host", "/a/"), "https://host/a/"); | 57 check(core.Uri.https("host", "/a/"), "https://host/a/"); |
58 check(core.Uri.https("host", "a/b"), "https://host/a/b"); | 58 check(core.Uri.https("host", "a/b"), "https://host/a/b"); |
59 check(core.Uri.https("host", "/a/b"), "https://host/a/b"); | 59 check(core.Uri.https("host", "/a/b"), "https://host/a/b"); |
60 check(core.Uri.https("host", "a/b/"), "https://host/a/b/"); | 60 check(core.Uri.https("host", "a/b/"), "https://host/a/b/"); |
61 check(core.Uri.https("host", "/a/b/"), "https://host/a/b/"); | 61 check(core.Uri.https("host", "/a/b/"), "https://host/a/b/"); |
62 check(core.Uri.https("host", "a b"), "https://host/a%20b"); | 62 check(core.Uri.https("host", "a b"), "https://host/a%20b"); |
63 check(core.Uri.https("host", "/a b"), "https://host/a%20b"); | 63 check(core.Uri.https("host", "/a b"), "https://host/a%20b"); |
64 check(core.Uri.https("host", "/a b/"), "https://host/a%20b/"); | 64 check(core.Uri.https("host", "/a b/"), "https://host/a%20b/"); |
65 check(core.Uri.https("host", "/a%2F"), "https://host/a%252F"); | 65 check(core.Uri.https("host", "/a%2F"), "https://host/a%252F"); |
66 check(core.Uri.https("host", "/a%2F/"), "https://host/a%252F/"); | 66 check(core.Uri.https("host", "/a%2F/"), "https://host/a%252F/"); |
67 check(core.Uri.https("host", "/a/b", dart.map({c: "d"})), "https://host/a/b?
c=d"); | 67 check(core.Uri.https("host", "/a/b", dart.map({c: "d"}, core.String, core.St
ring)), "https://host/a/b?c=d"); |
68 check(core.Uri.https("host", "/a/b", dart.map({"c=": "&d"})), "https://host/
a/b?c%3D=%26d"); | 68 check(core.Uri.https("host", "/a/b", dart.map({"c=": "&d"}, core.String, cor
e.String)), "https://host/a/b?c%3D=%26d"); |
69 check(core.Uri.https("[::]", "a"), "https://[::]/a"); | 69 check(core.Uri.https("[::]", "a"), "https://[::]/a"); |
70 check(core.Uri.https("[::127.0.0.1]", "a"), "https://[::127.0.0.1]/a"); | 70 check(core.Uri.https("[::127.0.0.1]", "a"), "https://[::127.0.0.1]/a"); |
71 }; | 71 }; |
72 dart.fn(uri_http_test.testHttpsUri, VoidTodynamic()); | 72 dart.fn(uri_http_test.testHttpsUri, VoidTodynamic()); |
73 uri_http_test.testResolveHttpScheme = function() { | 73 uri_http_test.testResolveHttpScheme = function() { |
74 let s = "//myserver:1234/path/some/thing"; | 74 let s = "//myserver:1234/path/some/thing"; |
75 let uri = core.Uri.parse(s); | 75 let uri = core.Uri.parse(s); |
76 let http = core.Uri.new({scheme: "http"}); | 76 let http = core.Uri.new({scheme: "http"}); |
77 let https = core.Uri.new({scheme: "https"}); | 77 let https = core.Uri.new({scheme: "https"}); |
78 expect$.Expect.equals(dart.str`http:${s}`, dart.toString(http.resolveUri(uri
))); | 78 expect$.Expect.equals(dart.str`http:${s}`, dart.toString(http.resolveUri(uri
))); |
79 expect$.Expect.equals(dart.str`https:${s}`, dart.toString(https.resolveUri(u
ri))); | 79 expect$.Expect.equals(dart.str`https:${s}`, dart.toString(https.resolveUri(u
ri))); |
80 }; | 80 }; |
81 dart.fn(uri_http_test.testResolveHttpScheme, VoidTodynamic()); | 81 dart.fn(uri_http_test.testResolveHttpScheme, VoidTodynamic()); |
82 uri_http_test.main = function() { | 82 uri_http_test.main = function() { |
83 uri_http_test.testHttpUri(); | 83 uri_http_test.testHttpUri(); |
84 uri_http_test.testHttpsUri(); | 84 uri_http_test.testHttpsUri(); |
85 uri_http_test.testResolveHttpScheme(); | 85 uri_http_test.testResolveHttpScheme(); |
86 }; | 86 }; |
87 dart.fn(uri_http_test.main, VoidTodynamic()); | 87 dart.fn(uri_http_test.main, VoidTodynamic()); |
88 // Exports: | 88 // Exports: |
89 exports.uri_http_test = uri_http_test; | 89 exports.uri_http_test = uri_http_test; |
90 }); | 90 }); |
OLD | NEW |