Skip to content

Instantly share code, notes, and snippets.

@annevk
Created June 16, 2015 15:03
Show Gist options
  • Save annevk/a8c2e8f37446cb298986 to your computer and use it in GitHub Desktop.
Save annevk/a8c2e8f37446cb298986 to your computer and use it in GitHub Desktop.
relative URL tests
# a set of tests designed by zcorpan for relative URLs
i sc:sd
i sc:sd/sd
i sc:/pa/pa s:sc p:/pa/i
i sc://ho/pa s:sc h:ho p:/i
i sc:///pa/pa s:sc h: p:/pa/i
../i sc:sd
../i sc:sd/sd
../i sc:/pa/pa s:sc p:/i
../i sc://ho/pa s:sc h:ho p:/i
../i sc:///pa/pa s:sc h: p:/i
/i sc:sd
/i sc:sd/sd
/i sc:/pa/pa s:sc p:/i
/i sc://ho/pa s:sc h:ho p:/i
/i sc:///pa/pa s:sc h: p:/i
?i sc:sd
?i sc:sd/sd
?i sc:/pa/pa s:sc p:/pa/pa q:?i
?i sc://ho/pa s:sc h:ho p:/pa q:?i
?i sc:///pa/pa s:sc h: p:/pa/pa q:?i
\#i sc:sd f:#i
\#i sc:sd/sd f:#i
\#i sc:/pa/pa s:sc p:/pa/pa f:#i
\#i sc://ho/pa s:sc h:ho p:/pa f:#i
\#i sc:///pa/pa s:sc h: p:/pa/pa f:#i
# make sure that relative URL logic works on known typically non-relative schemes too
about:/../ about:blank s:about p:/
data:/../ about:blank s:data p:/
javascript:/../ about:blank s:javascript p:/
mailto:/../ about:blank s:mailto p:/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment