diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2016-12-06 14:44:55 +0100 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2016-12-07 10:46:43 +0100 |
commit | dc1bda435fa1345737604767ee71859377d41530 (patch) | |
tree | f8d4207e70383513efc765280dcc78bdf43efd84 /test | |
parent | cc6e5c9df9b7b42eba9cdb51bea529c1d5c3a497 (diff) | |
download | qtlocation-mapboxgl-dc1bda435fa1345737604767ee71859377d41530.tar.gz |
[core] add util::isURL() for checking whether a string starts with a URL scheme
Diffstat (limited to 'test')
-rw-r--r-- | test/util/url.test.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/util/url.test.cpp b/test/util/url.test.cpp new file mode 100644 index 0000000000..c0ee30efab --- /dev/null +++ b/test/util/url.test.cpp @@ -0,0 +1,25 @@ +#include <mbgl/test/util.hpp> + +#include <mbgl/util/url.hpp> + +#include <memory> + +using namespace mbgl::util; + +TEST(URL, isURL) { + EXPECT_TRUE(isURL("mapbox://foo")); + EXPECT_TRUE(isURL("mapbox://")); + EXPECT_TRUE(isURL("mapbox-test-scheme://foo")); + EXPECT_TRUE(isURL("mapbox+style://foo")); + EXPECT_TRUE(isURL("mapbox-2.0://foo")); + EXPECT_TRUE(isURL("mapbox99://foo")); + + EXPECT_FALSE(isURL("mapbox:/")); + EXPECT_FALSE(isURL(" mapbox://")); + EXPECT_FALSE(isURL("://")); + EXPECT_FALSE(isURL("mapbox")); + EXPECT_FALSE(isURL("mapbox:foo")); + EXPECT_FALSE(isURL("mapbox:/foo")); + EXPECT_FALSE(isURL("test/mapbox://foo")); + EXPECT_FALSE(isURL("123://foo")); +} |