summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/util/url.test.cpp25
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"));
+}