OLD | NEW |
(Empty) | |
| 1 dart_library.library('corelib/uri_ipv4_test', null, /* Imports */[ |
| 2 'dart_sdk', |
| 3 'expect' |
| 4 ], function load__uri_ipv4_test(exports, dart_sdk, expect) { |
| 5 'use strict'; |
| 6 const core = dart_sdk.core; |
| 7 const _interceptors = dart_sdk._interceptors; |
| 8 const dart = dart_sdk.dart; |
| 9 const dartx = dart_sdk.dartx; |
| 10 const expect$ = expect.expect; |
| 11 const uri_ipv4_test = Object.create(null); |
| 12 let ListOfint = () => (ListOfint = dart.constFn(core.List$(core.int)))(); |
| 13 let JSArrayOfint = () => (JSArrayOfint = dart.constFn(_interceptors.JSArray$(c
ore.int)))(); |
| 14 let StringAndListOfintTovoid = () => (StringAndListOfintTovoid = dart.constFn(
dart.definiteFunctionType(dart.void, [core.String, ListOfint()])))(); |
| 15 let VoidToListOfint = () => (VoidToListOfint = dart.constFn(dart.definiteFunct
ionType(ListOfint(), [])))(); |
| 16 let dynamicTobool = () => (dynamicTobool = dart.constFn(dart.definiteFunctionT
ype(core.bool, [dart.dynamic])))(); |
| 17 let StringTovoid = () => (StringTovoid = dart.constFn(dart.definiteFunctionTyp
e(dart.void, [core.String])))(); |
| 18 let VoidTovoid = () => (VoidTovoid = dart.constFn(dart.definiteFunctionType(da
rt.void, [])))(); |
| 19 uri_ipv4_test.testParseIPv4Address = function() { |
| 20 function pass(host, out) { |
| 21 expect$.Expect.listEquals(core.Uri.parseIPv4Address(host), out); |
| 22 } |
| 23 dart.fn(pass, StringAndListOfintTovoid()); |
| 24 function fail(host) { |
| 25 expect$.Expect.throws(dart.fn(() => core.Uri.parseIPv4Address(host), VoidT
oListOfint()), dart.fn(e => core.FormatException.is(e), dynamicTobool())); |
| 26 } |
| 27 dart.fn(fail, StringTovoid()); |
| 28 pass('127.0.0.1', JSArrayOfint().of([127, 0, 0, 1])); |
| 29 pass('128.0.0.1', JSArrayOfint().of([128, 0, 0, 1])); |
| 30 pass('255.255.255.255', JSArrayOfint().of([255, 255, 255, 255])); |
| 31 pass('0.0.0.0', JSArrayOfint().of([0, 0, 0, 0])); |
| 32 fail('127.0.0.-1'); |
| 33 fail('255.255.255.256'); |
| 34 fail('0.0.0.0.'); |
| 35 fail('0.0.0.0.0'); |
| 36 fail('a.0.0.0'); |
| 37 fail('0.0..0'); |
| 38 }; |
| 39 dart.fn(uri_ipv4_test.testParseIPv4Address, VoidTovoid()); |
| 40 uri_ipv4_test.main = function() { |
| 41 uri_ipv4_test.testParseIPv4Address(); |
| 42 }; |
| 43 dart.fn(uri_ipv4_test.main, VoidTovoid()); |
| 44 // Exports: |
| 45 exports.uri_ipv4_test = uri_ipv4_test; |
| 46 }); |
OLD | NEW |