OLD | NEW |
(Empty) | |
| 1 dart_library.library('corelib/uri_scheme_test', null, /* Imports */[ |
| 2 'dart_sdk', |
| 3 'expect' |
| 4 ], function load__uri_scheme_test(exports, dart_sdk, expect) { |
| 5 'use strict'; |
| 6 const core = dart_sdk.core; |
| 7 const dart = dart_sdk.dart; |
| 8 const dartx = dart_sdk.dartx; |
| 9 const expect$ = expect.expect; |
| 10 const uri_scheme_test = Object.create(null); |
| 11 let VoidToUri = () => (VoidToUri = dart.constFn(dart.definiteFunctionType(core
.Uri, [])))(); |
| 12 let dynamicTobool = () => (dynamicTobool = dart.constFn(dart.definiteFunctionT
ype(core.bool, [dart.dynamic])))(); |
| 13 let VoidTovoid = () => (VoidTovoid = dart.constFn(dart.definiteFunctionType(da
rt.void, [])))(); |
| 14 let StringAndStringAndStringTodynamic = () => (StringAndStringAndStringTodynam
ic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.String, core.Str
ing, core.String])))(); |
| 15 let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionT
ype(dart.dynamic, [])))(); |
| 16 uri_scheme_test.testInvalidArguments = function() { |
| 17 expect$.Expect.throws(dart.fn(() => core.Uri.new({scheme: "_"}), VoidToUri()
), dart.fn(e => core.FormatException.is(e), dynamicTobool())); |
| 18 expect$.Expect.throws(dart.fn(() => core.Uri.new({scheme: "http_s"}), VoidTo
Uri()), dart.fn(e => core.FormatException.is(e), dynamicTobool())); |
| 19 expect$.Expect.throws(dart.fn(() => core.Uri.new({scheme: "127.0.0.1:80"}),
VoidToUri()), dart.fn(e => core.FormatException.is(e), dynamicTobool())); |
| 20 }; |
| 21 dart.fn(uri_scheme_test.testInvalidArguments, VoidTovoid()); |
| 22 uri_scheme_test.testScheme = function() { |
| 23 function test(expectedScheme, expectedUri, scheme) { |
| 24 let uri = core.Uri.new({scheme: scheme}); |
| 25 expect$.Expect.equals(expectedScheme, uri.scheme); |
| 26 expect$.Expect.equals(expectedUri, dart.toString(uri)); |
| 27 uri = core.Uri.parse(dart.str`${scheme}:`); |
| 28 expect$.Expect.equals(expectedScheme, uri.scheme); |
| 29 expect$.Expect.equals(expectedUri, dart.toString(uri)); |
| 30 } |
| 31 dart.fn(test, StringAndStringAndStringTodynamic()); |
| 32 test("http", "http:", "http"); |
| 33 test("http", "http:", "HTTP"); |
| 34 test("http", "http:", "hTTP"); |
| 35 test("http", "http:", "Http"); |
| 36 test("http+ssl", "http+ssl:", "HTTP+ssl"); |
| 37 test("urn", "urn:", "urn"); |
| 38 test("urn", "urn:", "UrN"); |
| 39 test("a123.432", "a123.432:", "a123.432"); |
| 40 }; |
| 41 dart.fn(uri_scheme_test.testScheme, VoidTovoid()); |
| 42 uri_scheme_test.main = function() { |
| 43 uri_scheme_test.testInvalidArguments(); |
| 44 uri_scheme_test.testScheme(); |
| 45 }; |
| 46 dart.fn(uri_scheme_test.main, VoidTodynamic()); |
| 47 // Exports: |
| 48 exports.uri_scheme_test = uri_scheme_test; |
| 49 }); |
OLD | NEW |