summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2014-04-26 13:51:14 +0200
committerCarlos Martín Nieto <cmn@dwim.me>2014-04-26 17:27:42 +0200
commit1f0d4f3d8dd5c87d3f42a913a1af9d6f1f2da437 (patch)
tree1131f54640997311712161008ef652e77fda118a /tests
parent4f9d54146d569fffb679386fd3057e571afacd1f (diff)
downloadlibgit2-1f0d4f3d8dd5c87d3f42a913a1af9d6f1f2da437.tar.gz
netops: unit-test the cert host-name pattern matching
This kind of stuff should have unit tests, even if it's just to show what we expect to match successfully.
Diffstat (limited to 'tests')
-rw-r--r--tests/network/matchhost.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/network/matchhost.c b/tests/network/matchhost.c
new file mode 100644
index 000000000..3100dc21d
--- /dev/null
+++ b/tests/network/matchhost.c
@@ -0,0 +1,13 @@
+#include "clar_libgit2.h"
+#include "netops.h"
+
+void test_network_matchhost__match(void)
+{
+ cl_git_pass(gitno__match_host("*.example.org", "www.example.org"));
+ cl_git_pass(gitno__match_host("*.foo.example.org", "www.foo.example.org"));
+ cl_git_fail(gitno__match_host("*.foo.example.org", "foo.example.org"));
+ cl_git_fail(gitno__match_host("*.foo.example.org", "www.example.org"));
+ cl_git_fail(gitno__match_host("*.example.org", "example.org"));
+ cl_git_fail(gitno__match_host("*.example.org", "www.foo.example.org"));
+ cl_git_fail(gitno__match_host("*.example.org", "blah.www.www.example.org"));
+}