@@ -131,12 +131,47 @@ void testUriPerRFCs() {
131131 // Additional tests (not from RFC 3986).
132132 testResolve ("http://a/b/g;p/h;s" , "../g;p/h;s" );
133133
134+ base = Uri .parse ("http://a?q" );
135+ testResolve ("http://a?p" , "?p" );
136+ testResolve ("http://a/b/c" , "b/c" );
137+
138+ base = Uri .parse ("foo:/a/b?q" );
139+ testResolve ("foo:/a/b?p" , "?p" );
140+ testResolve ("foo:/c" , "../c" );
141+ testResolve ("foo:/a/c" , "c" );
142+ testResolve ("foo:/c" , "../../c" );
143+ testResolve ("foo:/c" , "/c" );
144+
134145 // Test non-URI base (no scheme, no authority, relative path).
135146 base = Uri .parse ("a/b/c?_#_" );
136147 testResolve ("a/b/g?q#f" , "g?q#f" );
137148 testResolve ("../" , "../../.." );
149+ testResolve ("./" , "../.." );
138150 testResolve ("a/b/" , "." );
139151 testResolve ("c" , "../../c" );
152+ testResolve ("//foo/a" , "//foo/a" );
153+ testResolve ("a/b/c?_#f" , "#f" );
154+ testResolve ("a/b/c?q" , "?q" );
155+ testResolve ("a/b/c?q#c" , "?q#c" );
156+ testResolve ("a/b/c?_" , "" );
157+ testResolve ("/a" , "/a" );
158+ testResolve ("/b" , "/a/../../b" );
159+
160+ base = Uri .parse ("/a/b?_#_" );
161+ testResolve ("/a/c" , "c" );
162+ testResolve ("/c" , "../../c" );
163+
164+ base = Uri .parse ("//foo/a" );
165+ testResolve ("//foo/b" , "b" );
166+ testResolve ("//foo/" , ".." );
167+ testResolve ("//foo/c" , "../c" );
168+ testResolve ("s:/a/b" , "s:/a/b" );
169+ testResolve ("//bar/b" , "//bar/b" );
170+
171+ base = Uri .parse ("?_#_" );
172+ testResolve ("?q" , "?q" );
173+ testResolve ("?_#f" , "#f" );
174+ testResolve ("a/b" , "a/b" );
140175
141176 base = Uri .parse ("s:a/b" );
142177 testResolve ("s:/c" , "../c" );
0 commit comments