import * as url from "../../partial-src/component/url" export function run() { let uris = [ ["http://a/b/c/d;p?q", "g:h", "g:h"], ["http://a/b/c/d;p?q", "g", "http://a/b/c/g"], ["http://a/b/c/d;p?q", "./g", "http://a/b/c/g"], ["http://a/b/c/d;p?q", "g/", "http://a/b/c/g/"], ["http://a/b/c/d;p?q", "/g", "http://a/g"], ["http://a/b/c/d;p?q", "//g", "http://g/"], ["http://a/b/c/d;p?q", "?y", "http://a/b/c/d;p?y"], ["http://a/b/c/d;p?q", "g?y", "http://a/b/c/g?y"], ["http://a/b/c/d;p?q", "#s", "http://a/b/c/d;p?q#s"], ["http://a/b/c/d;p?q", "g#s", "http://a/b/c/g#s"], ["http://a/b/c/d;p?q", "g?y#s", "http://a/b/c/g?y#s"], ["http://a/b/c/d;p?q", ";x", "http://a/b/c/;x"], ["http://a/b/c/d;p?q", "g;x", "http://a/b/c/g;x"], ["http://a/b/c/d;p?q", "g;x?y#s", "http://a/b/c/g;x?y#s"], ["http://a/b/c/d;p?q", ".", "http://a/b/c/"], ["http://a/b/c/d;p?q", "./", "http://a/b/c/"], ["http://a/b/c/d;p?q", "..", "http://a/b/"], ["http://a/b/c/d;p?q", "../", "http://a/b/"], ["http://a/b/c/d;p?q", "../g", "http://a/b/g"], ["http://a/b/c/d;p?q", "../..", "http://a/"], ["http://a/b/c/d;p?q", "../../", "http://a/"], ["http://a/b/c/d;p?q", "../../g", "http://a/g"], ["http://a/b/c/d;p?q", "", "http://a/b/c/d;p?q"], ["http://a/b/c/d;p?q", "../../../g", "http://a/g"], ["http://a/b/c/d;p?q", "../../../../g", "http://a/g"], ["http://a/b/c/d;p?q", "/./g", "http://a/g"], ["http://a/b/c/d;p?q", "/../g", "http://a/g"], ["http://a/b/c/d;p?q", "g.", "http://a/b/c/g."], ["http://a/b/c/d;p?q", ".g", "http://a/b/c/.g"], ["http://a/b/c/d;p?q", "g..", "http://a/b/c/g.."], ["http://a/b/c/d;p?q", "..g", "http://a/b/c/..g"], ["http://a/b/c/d;p?q", "./../g", "http://a/b/g"], ["http://a/b/c/d;p?q", "./g/.", "http://a/b/c/g/"], ["http://a/b/c/d;p?q", "g/./h", "http://a/b/c/g/h"], ["http://a/b/c/d;p?q", "g/../h", "http://a/b/c/h"], ["http://a/b/c/d;p?q", "g;x=1/./y", "http://a/b/c/g;x=1/y"], ["http://a/b/c/d;p?q", "g;x=1/../y", "http://a/b/c/y"], ["http://a/b/c/d;p?q", "g?y/./x", "http://a/b/c/g?y/./x"], ["http://a/b/c/d;p?q", "g?y/../x", "http://a/b/c/g?y/../x"], ["http://a/b/c/d;p?q", "g#s/./x", "http://a/b/c/g#s/./x"], ["http://a/b/c/d;p?q", "g#s/../x", "http://a/b/c/g#s/../x"] ]; describe("test uris resolve", () => { for (let uri of uris) { it(`Test url resolve ${uri[0]} + ${uri[1]} => ${uri[2]}`, () => { let result = url.resolve(uri[0], uri[1]) if (result !== uri[2]) { console.error(uri, result) throw new Error("Fail to pass resolve:" + uri.join(" ") + " result is:" + result) } }) } }) }