Add stage2/ghci to ghc-api's import list.
[ghc-hetmet.git] / ghc / tests / lib / should_run / uri001.hs
1 module Main where
2
3 import Network.URI
4 import Data.Maybe
5
6 main =  sequence_ (map do_test tests)
7
8 base = fromJust (parseURI "http://a/b/c/d;p?q")
9
10 do_test test = case parseURI test of
11                         Nothing -> error ("no parse: " ++ test)
12                         Just uri -> putStr (show (fromJust (uri `relativeTo` base)) ++ "\n")
13
14 tests =
15   [   "g:h",
16       "g",
17       "./g",
18       "g/",
19       "/g",
20       "//g",
21       "?y",
22       "g?y",
23       "#s",
24       "g#s",
25       "g?y#s",
26       ";x",
27       "g;x",
28       "g;x?y#s",
29       ".",
30       "./",
31       "..",
32       "../",
33       "../g",
34       "../..",
35       "../../",
36       "../../g",
37       -- "../../../g" -- should fail
38       -- "../../../../g" -- should fail
39       "/./g",
40       "/../g",
41       "g.",
42       ".g",
43       "g..",
44       "..g",
45       "./../g",
46       "./g/.",
47       "g/./h",
48       "g/../h",
49       "g;x=1/./y",
50       "g;x=1/../y",
51       "g?y/./x",
52       "g?y/../x",
53       "g#s/./x",
54       "g#s/../x"
55   ]