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

Unified Diff: test/codegen/expect/corelib/uri_normalize_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 side-by-side diff with in-line comments
Download patch
Index: test/codegen/expect/corelib/uri_normalize_test.js
diff --git a/test/codegen/expect/corelib/uri_normalize_test.js b/test/codegen/expect/corelib/uri_normalize_test.js
new file mode 100644
index 0000000000000000000000000000000000000000..ff9757ef297fc7f0cb2f5bc7fc3199baa30e9cc8
--- /dev/null
+++ b/test/codegen/expect/corelib/uri_normalize_test.js
@@ -0,0 +1,77 @@
+dart_library.library('corelib/uri_normalize_test', null, /* Imports */[
+ 'dart_sdk',
+ 'expect'
+], function load__uri_normalize_test(exports, dart_sdk, expect) {
+ 'use strict';
+ const core = dart_sdk.core;
+ const dart = dart_sdk.dart;
+ const dartx = dart_sdk.dartx;
+ const expect$ = expect.expect;
+ const uri_normalize_test = Object.create(null);
+ let StringAndString__Todynamic = () => (StringAndString__Todynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.String, core.String], {scheme: core.String, host: core.String})))();
+ let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [])))();
+ uri_normalize_test.testNormalizePath = function() {
+ function test(expected, path, opts) {
+ let scheme = opts && 'scheme' in opts ? opts.scheme : null;
+ let host = opts && 'host' in opts ? opts.host : null;
+ let uri = core.Uri.new({scheme: scheme, host: host, path: path});
+ expect$.Expect.equals(expected, uri.toString());
+ if (scheme == null && host == null) {
+ expect$.Expect.equals(expected, uri.path);
+ }
+ }
+ dart.fn(test, StringAndString__Todynamic());
+ let unreserved = "-._~0123456789" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz";
+ test("A", "%41");
+ test("AB", "%41%42");
+ test("%40AB", "%40%41%42");
+ test("a", "%61");
+ test("ab", "%61%62");
+ test("%60ab", "%60%61%62");
+ test(unreserved, unreserved);
+ let x = new core.StringBuffer();
+ for (let i = 32; i < 128; i++) {
+ if (unreserved[dartx.indexOf](core.String.fromCharCode(i)) != -1) {
+ x.writeCharCode(i);
+ } else {
+ x.write("%");
+ x.write(i[dartx.toRadixString](16));
+ }
+ }
+ expect$.Expect.equals(x.toString()[dartx.toUpperCase](), core.Uri.new({path: x.toString()}).toString()[dartx.toUpperCase]());
+ test("/a/b/c/", "/../a/./b/z/../c/d/..");
+ test("/a/b/c/", "/./a/b/c/");
+ test("/a/b/c/", "/./../a/b/c/");
+ test("/a/b/c/", "/./../a/b/c/.");
+ test("/a/b/c/", "/./../a/b/c/z/./..");
+ test("/", "/a/..");
+ test("s:a/b/c/", "../a/./b/z/../c/d/..", {scheme: "s"});
+ test("s:a/b/c/", "./a/b/c/", {scheme: "s"});
+ test("s:a/b/c/", "./../a/b/c/", {scheme: "s"});
+ test("s:a/b/c/", "./../a/b/c/.", {scheme: "s"});
+ test("s:a/b/c/", "./../a/b/c/z/./..", {scheme: "s"});
+ test("s:/", "/a/..", {scheme: "s"});
+ test("s:/", "a/..", {scheme: "s"});
+ test("//h/a/b/c/", "../a/./b/z/../c/d/..", {host: "h"});
+ test("//h/a/b/c/", "./a/b/c/", {host: "h"});
+ test("//h/a/b/c/", "./../a/b/c/", {host: "h"});
+ test("//h/a/b/c/", "./../a/b/c/.", {host: "h"});
+ test("//h/a/b/c/", "./../a/b/c/z/./..", {host: "h"});
+ test("//h/", "/a/..", {host: "h"});
+ test("//h/", "a/..", {host: "h"});
+ test("../a/b/c/", "../a/./b/z/../c/d/..");
+ test("a/b/c/", "./a/b/c/");
+ test("../a/b/c/", "./../a/b/c/");
+ test("../a/b/c/", "./../a/b/c/.");
+ test("../a/b/c/", "./../a/b/c/z/./..");
+ test("/", "/a/..");
+ test("./", "a/..");
+ };
+ dart.fn(uri_normalize_test.testNormalizePath, VoidTodynamic());
+ uri_normalize_test.main = function() {
+ uri_normalize_test.testNormalizePath();
+ };
+ dart.fn(uri_normalize_test.main, VoidTodynamic());
+ // Exports:
+ exports.uri_normalize_test = uri_normalize_test;
+});
« no previous file with comments | « test/codegen/expect/corelib/uri_normalize_path_test.js ('k') | test/codegen/expect/corelib/uri_parameters_all_test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698