summaryrefslogtreecommitdiffstats
path: root/tests/util/url/valid.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/util/url/valid.c')
-rw-r--r--tests/util/url/valid.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/util/url/valid.c b/tests/util/url/valid.c
new file mode 100644
index 0000000..797b697
--- /dev/null
+++ b/tests/util/url/valid.c
@@ -0,0 +1,17 @@
+#include "clar_libgit2.h"
+#include "net.h"
+
+void test_url_valid__test(void)
+{
+ cl_assert(git_net_str_is_url("http://example.com/"));
+ cl_assert(git_net_str_is_url("file://localhost/tmp/foo/"));
+ cl_assert(git_net_str_is_url("ssh://user@host:42/tmp"));
+ cl_assert(git_net_str_is_url("git+ssh://user@host:42/tmp"));
+ cl_assert(git_net_str_is_url("ssh+git://user@host:42/tmp"));
+ cl_assert(git_net_str_is_url("https://user:pass@example.com/foo/bar"));
+
+ cl_assert(!git_net_str_is_url("host:foo.git"));
+ cl_assert(!git_net_str_is_url("host:/foo.git"));
+ cl_assert(!git_net_str_is_url("[host:42]:/foo.git"));
+ cl_assert(!git_net_str_is_url("[user@host:42]:/foo.git"));
+}