Home | History | Annotate | Download | only in script-tests
      1 description("Test resolution of relative UNIX-like URLs.");
      2 
      3 cases = [ 
      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 
     15 var originalBaseURL = canonicalize(".");
     16 
     17 for (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 
     26 setBaseURL(originalBaseURL);
     27 
     28 var successfullyParsed = true;
     29