| Index: test/codegen/expect/corelib/uri_ipv6_test.js
|
| diff --git a/test/codegen/expect/corelib/uri_ipv6_test.js b/test/codegen/expect/corelib/uri_ipv6_test.js
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..6c9b21a8c37cad1a31f6f6adb0938b5b70a09d99
|
| --- /dev/null
|
| +++ b/test/codegen/expect/corelib/uri_ipv6_test.js
|
| @@ -0,0 +1,148 @@
|
| +dart_library.library('corelib/uri_ipv6_test', null, /* Imports */[
|
| + 'dart_sdk',
|
| + 'expect'
|
| +], function load__uri_ipv6_test(exports, dart_sdk, expect) {
|
| + 'use strict';
|
| + const core = dart_sdk.core;
|
| + const _interceptors = dart_sdk._interceptors;
|
| + const dart = dart_sdk.dart;
|
| + const dartx = dart_sdk.dartx;
|
| + const expect$ = expect.expect;
|
| + const uri_ipv6_test = Object.create(null);
|
| + let ListOfint = () => (ListOfint = dart.constFn(core.List$(core.int)))();
|
| + let JSArrayOfint = () => (JSArrayOfint = dart.constFn(_interceptors.JSArray$(core.int)))();
|
| + let VoidTovoid = () => (VoidTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [])))();
|
| + let StringAndListOfintTovoid = () => (StringAndListOfintTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String, ListOfint()])))();
|
| + let VoidToListOfint = () => (VoidToListOfint = dart.constFn(dart.definiteFunctionType(ListOfint(), [])))();
|
| + let dynamicTobool = () => (dynamicTobool = dart.constFn(dart.definiteFunctionType(core.bool, [dart.dynamic])))();
|
| + let StringTovoid = () => (StringTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String])))();
|
| + uri_ipv6_test.testValidIpv6Uri = function() {
|
| + let path = 'http://[::1]:1234/path?query=5#now';
|
| + let uri = core.Uri.parse(path);
|
| + expect$.Expect.equals('http', uri.scheme);
|
| + expect$.Expect.equals('::1', uri.host);
|
| + expect$.Expect.equals(1234, uri.port);
|
| + expect$.Expect.equals('/path', uri.path);
|
| + expect$.Expect.equals('query=5', uri.query);
|
| + expect$.Expect.equals('now', uri.fragment);
|
| + expect$.Expect.equals(path, dart.toString(uri));
|
| + path = 'http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:8080/index.html';
|
| + uri = core.Uri.parse(path);
|
| + expect$.Expect.equals('http', uri.scheme);
|
| + expect$.Expect.equals('fedc:ba98:7654:3210:fedc:ba98:7654:3210', uri.host);
|
| + expect$.Expect.equals(8080, uri.port);
|
| + expect$.Expect.equals('/index.html', uri.path);
|
| + expect$.Expect.equals(path[dartx.toLowerCase](), dart.toString(uri));
|
| + path = 'http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html';
|
| + uri = core.Uri.parse(path);
|
| + expect$.Expect.equals('http', uri.scheme);
|
| + expect$.Expect.equals('fedc:ba98:7654:3210:fedc:ba98:7654:3210', uri.host);
|
| + expect$.Expect.equals(80, uri.port);
|
| + expect$.Expect.equals('/index.html', uri.path);
|
| + expect$.Expect.equals('http://[fedc:ba98:7654:3210:fedc:ba98:7654:3210]/index.html', dart.toString(uri));
|
| + path = 'https://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:443/index.html';
|
| + uri = core.Uri.parse(path);
|
| + expect$.Expect.equals('https', uri.scheme);
|
| + expect$.Expect.equals('fedc:ba98:7654:3210:fedc:ba98:7654:3210', uri.host);
|
| + expect$.Expect.equals(443, uri.port);
|
| + expect$.Expect.equals('/index.html', uri.path);
|
| + expect$.Expect.equals('https://[fedc:ba98:7654:3210:fedc:ba98:7654:3210]/index.html', dart.toString(uri));
|
| + path = 'http://[1080:0:0:0:8:800:200C:417A]/index.html';
|
| + uri = core.Uri.parse(path);
|
| + expect$.Expect.equals('http', uri.scheme);
|
| + expect$.Expect.equals('1080:0:0:0:8:800:200c:417a', uri.host);
|
| + expect$.Expect.equals(80, uri.port);
|
| + expect$.Expect.equals('/index.html', uri.path);
|
| + expect$.Expect.equals(path[dartx.toLowerCase](), dart.toString(uri));
|
| + path = 'http://[3ffe:2a00:100:7031::1]';
|
| + uri = core.Uri.parse(path);
|
| + expect$.Expect.equals('http', uri.scheme);
|
| + expect$.Expect.equals('3ffe:2a00:100:7031::1', uri.host);
|
| + expect$.Expect.equals(80, uri.port);
|
| + expect$.Expect.equals('', uri.path);
|
| + expect$.Expect.equals(path, dart.toString(uri));
|
| + path = 'http://[1080::8:800:200C:417A]/foo';
|
| + uri = core.Uri.parse(path);
|
| + expect$.Expect.equals('http', uri.scheme);
|
| + expect$.Expect.equals('1080::8:800:200c:417a', uri.host);
|
| + expect$.Expect.equals(80, uri.port);
|
| + expect$.Expect.equals('/foo', uri.path);
|
| + expect$.Expect.equals(path[dartx.toLowerCase](), dart.toString(uri));
|
| + path = 'http://[::192.9.5.5]/ipng';
|
| + uri = core.Uri.parse(path);
|
| + expect$.Expect.equals('http', uri.scheme);
|
| + expect$.Expect.equals('::192.9.5.5', uri.host);
|
| + expect$.Expect.equals(80, uri.port);
|
| + expect$.Expect.equals('/ipng', uri.path);
|
| + expect$.Expect.equals(path, dart.toString(uri));
|
| + path = 'http://[::FFFF:129.144.52.38]:8080/index.html';
|
| + uri = core.Uri.parse(path);
|
| + expect$.Expect.equals('http', uri.scheme);
|
| + expect$.Expect.equals('::ffff:129.144.52.38', uri.host);
|
| + expect$.Expect.equals(8080, uri.port);
|
| + expect$.Expect.equals('/index.html', uri.path);
|
| + expect$.Expect.equals(path[dartx.toLowerCase](), dart.toString(uri));
|
| + path = 'http://[::FFFF:129.144.52.38]:80/index.html';
|
| + uri = core.Uri.parse(path);
|
| + expect$.Expect.equals('http', uri.scheme);
|
| + expect$.Expect.equals('::ffff:129.144.52.38', uri.host);
|
| + expect$.Expect.equals(80, uri.port);
|
| + expect$.Expect.equals('/index.html', uri.path);
|
| + expect$.Expect.equals('http://[::ffff:129.144.52.38]/index.html', dart.toString(uri));
|
| + path = 'https://[::FFFF:129.144.52.38]:443/index.html';
|
| + uri = core.Uri.parse(path);
|
| + expect$.Expect.equals('https', uri.scheme);
|
| + expect$.Expect.equals('::ffff:129.144.52.38', uri.host);
|
| + expect$.Expect.equals(443, uri.port);
|
| + expect$.Expect.equals('/index.html', uri.path);
|
| + expect$.Expect.equals('https://[::ffff:129.144.52.38]/index.html', dart.toString(uri));
|
| + path = 'http://[2010:836B:4179::836B:4179]';
|
| + uri = core.Uri.parse(path);
|
| + expect$.Expect.equals('http', uri.scheme);
|
| + expect$.Expect.equals('2010:836b:4179::836b:4179', uri.host);
|
| + expect$.Expect.equals(80, uri.port);
|
| + expect$.Expect.equals('', uri.path);
|
| + expect$.Expect.equals(path[dartx.toLowerCase](), dart.toString(uri));
|
| + };
|
| + dart.fn(uri_ipv6_test.testValidIpv6Uri, VoidTovoid());
|
| + uri_ipv6_test.testParseIPv6Address = function() {
|
| + function pass(host, expected) {
|
| + expect$.Expect.listEquals(expected, core.Uri.parseIPv6Address(host));
|
| + }
|
| + dart.fn(pass, StringAndListOfintTovoid());
|
| + function fail(host) {
|
| + expect$.Expect.throws(dart.fn(() => core.Uri.parseIPv6Address(host), VoidToListOfint()), dart.fn(e => core.FormatException.is(e), dynamicTobool()));
|
| + }
|
| + dart.fn(fail, StringTovoid());
|
| + pass('::127.0.0.1', JSArrayOfint().of([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 127, 0, 0, 1]));
|
| + pass('0::127.0.0.1', JSArrayOfint().of([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 127, 0, 0, 1]));
|
| + pass('::', JSArrayOfint().of([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]));
|
| + pass('0::', JSArrayOfint().of([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('00000::0');
|
| + fail('-1::0');
|
| + fail('-AAA::0');
|
| + fail('0::127.0.0.1:0');
|
| + fail('0::127.0.0');
|
| + pass('0::1111', JSArrayOfint().of([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 17, 17]));
|
| + pass('2010:836B:4179::836B:4179', JSArrayOfint().of([32, 16, 131, 107, 65, 121, 0, 0, 0, 0, 0, 0, 131, 107, 65, 121]));
|
| + fail('2010:836B:4179:0000:127.0.0.1');
|
| + fail('2010:836B:4179:0000:0000:127.0.0.1');
|
| + fail('2010:836B:4179:0000:0000:0000::127.0.0.1');
|
| + fail('2010:836B:4179:0000:0000:0000:0000:127.0.0.1');
|
| + pass('2010:836B:4179:0000:0000:0000:127.0.0.1', JSArrayOfint().of([32, 16, 131, 107, 65, 121, 0, 0, 0, 0, 0, 0, 127, 0, 0, 1]));
|
| + };
|
| + dart.fn(uri_ipv6_test.testParseIPv6Address, VoidTovoid());
|
| + uri_ipv6_test.main = function() {
|
| + uri_ipv6_test.testValidIpv6Uri();
|
| + uri_ipv6_test.testParseIPv6Address();
|
| + };
|
| + dart.fn(uri_ipv6_test.main, VoidTovoid());
|
| + // Exports:
|
| + exports.uri_ipv6_test = uri_ipv6_test;
|
| +});
|
|
|