added test cases Signed-off-by: Josef Zlomek <jo...@pex.com> --- libavformat/tests/url.c | 11 ++++++++++- tests/ref/fate/url | 9 +++++++++ 2 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/libavformat/tests/url.c b/libavformat/tests/url.c index 1d961a1b43..029be6ff10 100644 --- a/libavformat/tests/url.c +++ b/libavformat/tests/url.c @@ -23,7 +23,7 @@ static void test(const char *base, const char *rel) { - char buf[200], buf2[200]; + char buf[80], buf2[80]; ff_make_absolute_url(buf, sizeof(buf), base, rel); printf("%50s %-20s => %s\n", base, rel, buf); if (base) { @@ -57,6 +57,9 @@ int main(void) test("/foo/bar", "../baz"); test("/foo/bar", "/baz"); test("/foo/bar", "../../../baz"); + test("/foo/bar", ".."); + test("/foo/bar/baz", ".."); + test("http://server", ""); test("http://server/foo/", "baz"); test("http://server/foo/bar", "baz"); test("http://server/foo/", "../baz"); @@ -65,11 +68,17 @@ int main(void) test("http://server/foo/bar/123", "https://other/url"); test("http://server/foo/bar?param=value/with/slashes", "/baz"); test("http://server/foo/bar?param&otherparam", "?someparam"); + test("http://server/foo/bar", "simple/relative/path"); test("http://server/foo/bar", "//other/url"); test("http://server/foo/bar", "../../../../../other/url"); + test("http://server/foo/bar", "a/b/../c/d/../e../..f/.../other/url/test..mp3"); + test("http://server/foo/bar", "/a/b/../c/d/../e../..f/.../other/url/test..mp3"); + test("http://server/foo/bar", "a/b/../c/d/../e../..f/.../other/url/.."); + test("http://server/foo/bar", "a/b/../c/d/../e../..f/.../other/url/"); test("http://server/foo/bar", "/../../../../../other/url"); test("http://server/foo/bar", "/test/../../../../../other/url"); test("http://server/foo/bar", "/test/../../test/../../../other/url"); + test("http://server/foo/bar", "/too/long1/too/long2/too/long3/too/long4/too/long5/too/long6/too/long7"); printf("\nTesting av_url_split:\n"); test2("/foo/bar"); diff --git a/tests/ref/fate/url b/tests/ref/fate/url index 533ba2cb1e..20c37bc826 100644 --- a/tests/ref/fate/url +++ b/tests/ref/fate/url @@ -4,6 +4,9 @@ Testing ff_make_absolute_url: /foo/bar ../baz => /baz /foo/bar /baz => /baz /foo/bar ../../../baz => /baz + /foo/bar .. => / + /foo/bar/baz .. => /foo/ + http://server => http://server http://server/foo/ baz => http://server/foo/baz http://server/foo/bar baz => http://server/foo/baz http://server/foo/ ../baz => http://server/baz @@ -12,11 +15,17 @@ Testing ff_make_absolute_url: http://server/foo/bar/123 https://other/url => https://other/url http://server/foo/bar?param=value/with/slashes /baz => http://server/baz http://server/foo/bar?param&otherparam ?someparam => http://server/foo/bar?someparam + http://server/foo/bar simple/relative/path => http://server/foo/simple/relative/path http://server/foo/bar //other/url => http://other/url http://server/foo/bar ../../../../../other/url => http://server/other/url + http://server/foo/bar a/b/../c/d/../e../..f/.../other/url/test..mp3 => http://server/foo/a/c/e../..f/.../other/url/test..mp3 + http://server/foo/bar /a/b/../c/d/../e../..f/.../other/url/test..mp3 => http://server/a/c/e../..f/.../other/url/test..mp3 + http://server/foo/bar a/b/../c/d/../e../..f/.../other/url/.. => http://server/foo/a/c/e../..f/.../other/ + http://server/foo/bar a/b/../c/d/../e../..f/.../other/url/ => http://server/foo/a/c/e../..f/.../other/url/ http://server/foo/bar /../../../../../other/url => http://server/other/url http://server/foo/bar /test/../../../../../other/url => http://server/other/url http://server/foo/bar /test/../../test/../../../other/url => http://server/other/url + http://server/foo/bar /too/long1/too/long2/too/long3/too/long4/too/long5/too/long6/too/long7 => http://server/too/long1/too/long2/too/long3/too/long4/too/long5/too/long6/too/l Testing av_url_split: /foo/bar => -1 /foo/bar -- 2.17.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".