From 5b80b067e7cd5d25be09641e228f0a08534c6a03 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Wed, 30 Nov 2016 16:47:16 +0300 Subject: Adapt to semantics change of path::normalize() --- tests/repository-location/driver.cxx | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/repository-location/driver.cxx b/tests/repository-location/driver.cxx index 441e295..6b4a1d7 100644 --- a/tests/repository-location/driver.cxx +++ b/tests/repository-location/driver.cxx @@ -133,7 +133,6 @@ main (int argc, char* argv[]) assert (bad_location ("1/..")); assert (bad_location ("bbb")); assert (bad_location ("aaa/bbb")); - assert (bad_location ("/aaa/bbb")); assert (bad_location ("http://aa")); assert (bad_location ("https://aa")); assert (bad_location ("http://aa/")); @@ -143,6 +142,12 @@ main (int argc, char* argv[]) assert (bad_location ("http://a.com/../c/1/aa")); assert (bad_location ("http://a.com/a/b/../../../c/1/aa")); +#ifndef _WIN32 + assert (bad_location ("/aaa/bbb")); +#else + assert (bad_location ("c:\\aaa\\bbb")); +#endif + // Invalid version. // assert (bad_location ("3/aaa/bbb")); @@ -159,6 +164,11 @@ main (int argc, char* argv[]) repository_location ( "http://stable.cppget.org/1/misc"))); + + assert (bad_location ("../..", + repository_location ( + "http://stable.cppget.org/1/misc"))); + // Invalid web interface URL. // assert (bad_url (".a/..", @@ -225,6 +235,11 @@ main (int argc, char* argv[]) assert (l.string () == "b/pkg/1/aa/bb"); assert (l.canonical_name ().empty ()); } + { + repository_location l ("aa/..", repository_location ()); + assert (l.string () == "."); + assert (l.canonical_name ().empty ()); + } #ifndef _WIN32 { repository_location l ("/1/aa/bb", repository_location ()); @@ -427,6 +442,18 @@ main (int argc, char* argv[]) assert (l2.canonical_name () == "stable.cppget.org/math"); } { + repository_location l1 ("http://stable.cppget.org/1/misc"); + repository_location l2 ("math/..", l1); + assert (l2.string () == "http://stable.cppget.org/1/misc"); + assert (l2.canonical_name () == "stable.cppget.org/misc"); + } + { + repository_location l1 ("http://stable.cppget.org/1/misc"); + repository_location l2 (".", l1); + assert (l2.string () == "http://stable.cppget.org/1/misc"); + assert (l2.canonical_name () == "stable.cppget.org/misc"); + } + { repository_location l1 ("http://www.stable.cppget.org:8080/1"); repository_location l2 ("../1/math", l1); assert (l2.string () == "http://www.stable.cppget.org:8080/1/math"); -- cgit v1.1