summaryrefslogtreecommitdiff
path: root/test/util/url.test.cpp
blob: c0ee30efabcad35f483f0feb91963361916a8696 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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"));
}