Chromium Code Reviews| Index: tests/corelib/uri_ipv6_test.dart |
| diff --git a/tests/corelib/uri_ipv6_test.dart b/tests/corelib/uri_ipv6_test.dart |
| index 1ec9d57589776d58c59ef1e3b272ccd03347c0bb..ad7d8c893b5876f654e30674fa1708c8bf42a3f0 100644 |
| --- a/tests/corelib/uri_ipv6_test.dart |
| +++ b/tests/corelib/uri_ipv6_test.dart |
| @@ -107,7 +107,36 @@ void testValidIpv6Uri() { |
| Expect.equals(path, uri.toString()); |
| } |
| + |
| +void testParseIPv6Address() { |
| + void pass(String host, List<int> expected) { |
| + Expect.listEquals(expected, Uri.parseIPv6Address(host)); |
| + } |
| + void fail(String host) { |
| + Expect.throws(() => Uri.parseIPv6Address(host), |
| + (e) => e is FormatException); |
| + } |
| + |
| + pass('::127.0.0.1', [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 127, 0, 0, 1]); |
| + pass('0::127.0.0.1', [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 127, 0, 0, 1]); |
| + pass('::', [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]); |
| + pass('0::', [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]); |
| + fail(':0::127.0.0.1'); |
| + fail('0:::'); |
| + fail(':::'); |
| + fail('::0:'); |
| + fail('::0::'); |
| + fail('::0::0'); |
| + fail('0::127.0.0.1:0'); |
| + fail('0::127.0.0'); |
| + pass('0::1111', [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 17]); |
| + pass('2010:836B:4179::836B:4179', |
| + [32, 16, 131, 107, 65, 121, 0, 0, 0, 0, 0, 0, 131, 107, 65, 121] ); |
|
Søren Gjesse
2013/09/10 12:18:03
Maybe add a test without wildcards both with and w
Anders Johnsen
2013/09/11 12:58:31
Done.
|
| +} |
| + |
| + |
| void main() { |
| testValidIpv6Uri(); |
| + testParseIPv6Address(); |
| } |