relative-unix.js revision 430b6b672341c7e8b5e4cfafaaae20315e68701b
1description("Test resolution of relative UNIX-like URLs.");
2
3cases = [
4  // Format: [baseURL, relativeURL, expectedURL],
5  // On Unix we fall back to relative behavior since there's nothing else
6  // reasonable to do.
7  ["http://host/a", "\\\\\\\\Another\\\\path", "http://another/path"],
8
9  // Even on Windows, we don't allow relative drive specs when the base
10  // is not file.
11  ["http://host/a", "/c:\\\\foo", "http://host/c:/foo"],
12  ["http://host/a", "//c:\\\\foo", "http://c/foo"],
13];
14
15var originalBaseURL = canonicalize(".");
16
17for (var i = 0; i < cases.length; ++i) {
18  baseURL = cases[i][0];
19  relativeURL = cases[i][1];
20  expectedURL = cases[i][2];
21  setBaseURL(baseURL);
22  shouldBe("canonicalize('" + relativeURL + "')",
23           "'" + expectedURL + "'");
24}
25
26setBaseURL(originalBaseURL);
27
28var successfullyParsed = true;
29