Skip to content

Commit b6e5ae4

Browse files
stofCommit Queue
authored andcommitted
Add tests covering more cases for Uri.resolve
Closes #62073 GitOrigin-RevId: 3a50ef2 Change-Id: I75399055709a3b8260e67214b2017b76795e741e Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/464040 Reviewed-by: Lasse Nielsen <lrn@google.com> Commit-Queue: Lasse Nielsen <lrn@google.com>
1 parent e81bc5e commit b6e5ae4

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

tests/corelib/uri_test.dart

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)