| OLD | NEW |
| 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 #library('uriTest'); | 5 #library('uriTest'); |
| 6 | 6 |
| 7 #import('../../lib/utf/utf.dart'); | 7 #import('../../lib/utf/utf.dart'); |
| 8 #import('../../lib/uri/uri.dart'); | 8 #import('../../lib/uri/uri.dart'); |
| 9 | 9 |
| 10 testUri(String uri, bool isAbsolute) { | 10 testUri(String uri, bool isAbsolute) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 Expect.stringEquals(orig, d); | 21 Expect.stringEquals(orig, d); |
| 22 } | 22 } |
| 23 | 23 |
| 24 testEncodeDecodeComponent(String orig, String encoded) { | 24 testEncodeDecodeComponent(String orig, String encoded) { |
| 25 var e = encodeUriComponent(orig); | 25 var e = encodeUriComponent(orig); |
| 26 Expect.stringEquals(encoded, e); | 26 Expect.stringEquals(encoded, e); |
| 27 var d = decodeUriComponent(encoded); | 27 var d = decodeUriComponent(encoded); |
| 28 Expect.stringEquals(orig, d); | 28 Expect.stringEquals(orig, d); |
| 29 } | 29 } |
| 30 | 30 |
| 31 testUriPerRFCs(URI base) { | 31 testUriPerRFCs(Uri base) { |
| 32 // From RFC 3986. | 32 // From RFC 3986. |
| 33 Expect.stringEquals("g:h", base.resolve("g:h").toString()); | 33 Expect.stringEquals("g:h", base.resolve("g:h").toString()); |
| 34 Expect.stringEquals("http://a/b/c/g", base.resolve("g").toString()); | 34 Expect.stringEquals("http://a/b/c/g", base.resolve("g").toString()); |
| 35 Expect.stringEquals("http://a/b/c/g", base.resolve("./g").toString()); | 35 Expect.stringEquals("http://a/b/c/g", base.resolve("./g").toString()); |
| 36 Expect.stringEquals("http://a/b/c/g/", base.resolve("g/").toString()); | 36 Expect.stringEquals("http://a/b/c/g/", base.resolve("g/").toString()); |
| 37 Expect.stringEquals("http://a/g", base.resolve("/g").toString()); | 37 Expect.stringEquals("http://a/g", base.resolve("/g").toString()); |
| 38 Expect.stringEquals("http://g", base.resolve("//g").toString()); | 38 Expect.stringEquals("http://g", base.resolve("//g").toString()); |
| 39 Expect.stringEquals("http://a/b/c/d;p?y", base.resolve("?y").toString()); | 39 Expect.stringEquals("http://a/b/c/d;p?y", base.resolve("?y").toString()); |
| 40 Expect.stringEquals("http://a/b/c/g?y", base.resolve("g?y").toString()); | 40 Expect.stringEquals("http://a/b/c/g?y", base.resolve("g?y").toString()); |
| 41 Expect.stringEquals("http://a/b/c/d;p?q#s", base.resolve("#s").toString()); | 41 Expect.stringEquals("http://a/b/c/d;p?q#s", base.resolve("#s").toString()); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 testEncodeDecodeComponent("\uFFFE", "%EF%BF%BE"); | 135 testEncodeDecodeComponent("\uFFFE", "%EF%BF%BE"); |
| 136 testEncodeDecodeComponent("\uFFFF", "%EF%BF%BF"); | 136 testEncodeDecodeComponent("\uFFFF", "%EF%BF%BF"); |
| 137 testEncodeDecodeComponent("\uFFFE", "%EF%BF%BE"); | 137 testEncodeDecodeComponent("\uFFFE", "%EF%BF%BE"); |
| 138 testEncodeDecodeComponent("\uFFFF", "%EF%BF%BF"); | 138 testEncodeDecodeComponent("\uFFFF", "%EF%BF%BF"); |
| 139 testEncodeDecodeComponent("\x7f", "%7F"); | 139 testEncodeDecodeComponent("\x7f", "%7F"); |
| 140 testEncodeDecodeComponent("\x80", "%C2%80"); | 140 testEncodeDecodeComponent("\x80", "%C2%80"); |
| 141 testEncodeDecodeComponent("\u0800", "%E0%A0%80"); | 141 testEncodeDecodeComponent("\u0800", "%E0%A0%80"); |
| 142 testEncodeDecodeComponent(":/@',;?&=+\$", "%3A%2F%40'%2C%3B%3F%26%3D%2B%24"); | 142 testEncodeDecodeComponent(":/@',;?&=+\$", "%3A%2F%40'%2C%3B%3F%26%3D%2B%24"); |
| 143 testEncodeDecodeComponent(s, "%F0%90%80%80"); | 143 testEncodeDecodeComponent(s, "%F0%90%80%80"); |
| 144 } | 144 } |
| OLD | NEW |