Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(307)

Side by Side Diff: test/codegen/expect/corelib/uri_parse_test.js

Issue 2128353002: Check in codegen test expectations. (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 dart_library.library('corelib/uri_parse_test', null, /* Imports */[
2 'dart_sdk',
3 'expect'
4 ], function load__uri_parse_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_parse_test = Object.create(null);
12 let JSArrayOfString = () => (JSArrayOfString = dart.constFn(_interceptors.JSAr ray$(core.String)))();
13 let JSArrayOfUri = () => (JSArrayOfUri = dart.constFn(_interceptors.JSArray$(c ore.Uri)))();
14 let dynamicAnddynamicAnddynamic__Tovoid = () => (dynamicAnddynamicAnddynamic__ Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [dart.dynamic, dart.d ynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic, dart.dynamic]))) ();
15 let VoidTovoid = () => (VoidTovoid = dart.constFn(dart.definiteFunctionType(da rt.void, [])))();
16 uri_parse_test.testUriCombi = function() {
17 let schemes = JSArrayOfString().of(["", "file", "ws", "ftp"]);
18 let fragments = JSArrayOfString().of(["", "#", "#f", "#fragment", "#l:?/"]);
19 let queries = JSArrayOfString().of(["", "?", "?q", "?query", "?q:/"]);
20 let paths = JSArrayOfString().of(["/", "/x", "/x/y", "/x/y/", "/x:y", "x", " x/y", "x/y/"]);
21 let userInfos = JSArrayOfString().of(["", "x", "xxx", "x:4", "xxx:444", "x:4 :x"]);
22 let hosts = JSArrayOfString().of(["", "h", "hhh", "h:4", "hhh:444", "[::1.2. 3.4]"]);
23 function check(uriString, scheme, fragment, query, path, user, host) {
24 for (let uri of JSArrayOfUri().of([core.Uri.parse(core.String._check(uriSt ring)), core.Uri.parse(dart.str`>𐀀>${uriString}<𐀀<`, 4, core.int._check(dart.dse nd(dart.dload(uriString, 'length'), '+', 4))), core.Uri.parse(dart.str`http://ex ample.com/${uriString}#?:/[]"`, 19, core.int._check(dart.dsend(dart.dload(uriStr ing, 'length'), '+', 19))), core.Uri.parse(core.String._check(dart.dsend(uriStri ng, '*', 3)), core.int._check(dart.dload(uriString, 'length')), core.int._check( dart.dsend(dart.dload(uriString, 'length'), '*', 2)))])) {
25 let name = dart.str`${uriString} -> ${uri}`;
26 expect$.Expect.equals(scheme, uri.scheme, name);
27 let uriFragment = uri.fragment;
28 if (dart.test(dart.dsend(fragment, 'startsWith', '#'))) uriFragment = da rt.str`#${uriFragment}`;
29 expect$.Expect.equals(fragment, uriFragment, name);
30 let uriQuery = uri.query;
31 if (dart.test(dart.dsend(query, 'startsWith', '?'))) uriQuery = dart.str `?${uriQuery}`;
32 expect$.Expect.equals(query, uriQuery, name);
33 expect$.Expect.equals(path, uri.path, name);
34 expect$.Expect.equals(user, uri.userInfo, name);
35 let uriHost = uri.host;
36 if (dart.test(dart.dsend(host, 'startsWith', "["))) uriHost = dart.str`[ ${uriHost}]`;
37 if (uri.port != 0) {
38 uriHost = dart.notNull(uriHost) + dart.str`:${uri.port}`;
39 }
40 expect$.Expect.equals(host, uriHost, name);
41 }
42 }
43 dart.fn(check, dynamicAnddynamicAnddynamic__Tovoid());
44 for (let scheme of schemes) {
45 for (let fragment of fragments) {
46 for (let query of queries) {
47 for (let path of paths) {
48 if (scheme == "file" && !dart.test(path[dartx.startsWith]('/'))) con tinue;
49 for (let user of userInfos) {
50 for (let host of hosts) {
51 let auth = host;
52 let s = scheme;
53 if (dart.test(user[dartx.isNotEmpty])) auth = dart.str`${user}@$ {auth}`;
54 if (dart.test(auth[dartx.isNotEmpty])) auth = dart.str`//${auth} `;
55 if (dart.test(auth[dartx.isNotEmpty]) && !dart.test(path[dartx.s tartsWith]('/'))) continue;
56 check(dart.str`${scheme}${dart.test(scheme[dartx.isEmpty]) ? "" : ":"}` + dart.str`${auth}${path}${query}${fragment}`, scheme, fragment, query, path, user, host);
57 }
58 }
59 }
60 }
61 }
62 }
63 };
64 dart.fn(uri_parse_test.testUriCombi, VoidTovoid());
65 uri_parse_test.main = function() {
66 uri_parse_test.testUriCombi();
67 };
68 dart.fn(uri_parse_test.main, VoidTovoid());
69 // Exports:
70 exports.uri_parse_test = uri_parse_test;
71 });
OLDNEW
« no previous file with comments | « test/codegen/expect/corelib/uri_parameters_all_test.js ('k') | test/codegen/expect/corelib/uri_path_test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698