Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2016-04-13 16:22:42 +0300
committerJunio C Hamano <gitster@pobox.com>2016-04-15 20:12:19 +0300
commite6e7530d10b74d763b4311ea93e0a831b810d6c2 (patch)
tree7ac83d3fecd39d6076f24eaddd6719a24c3b6ce8 /test-urlmatch-normalization.c
parent7897d84b8240720352e23030c35db461581b68e3 (diff)
test helpers: move test-* to t/helper/ subdirectory
This keeps top dir a bit less crowded. And because these programs are for testing purposes, it makes sense that they stay somewhere in t/ Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'test-urlmatch-normalization.c')
-rw-r--r--test-urlmatch-normalization.c50
1 files changed, 0 insertions, 50 deletions
diff --git a/test-urlmatch-normalization.c b/test-urlmatch-normalization.c
deleted file mode 100644
index 090bf219a7..0000000000
--- a/test-urlmatch-normalization.c
+++ /dev/null
@@ -1,50 +0,0 @@
-#include "git-compat-util.h"
-#include "urlmatch.h"
-
-int main(int argc, char **argv)
-{
- const char usage[] = "test-urlmatch-normalization [-p | -l] <url1> | <url1> <url2>";
- char *url1, *url2;
- int opt_p = 0, opt_l = 0;
-
- /*
- * For one url, succeed if url_normalize succeeds on it, fail otherwise.
- * For two urls, succeed only if url_normalize succeeds on both and
- * the results compare equal with strcmp. If -p is given (one url only)
- * and url_normalize succeeds, print the result followed by "\n". If
- * -l is given (one url only) and url_normalize succeeds, print the
- * returned length in decimal followed by "\n".
- */
-
- if (argc > 1 && !strcmp(argv[1], "-p")) {
- opt_p = 1;
- argc--;
- argv++;
- } else if (argc > 1 && !strcmp(argv[1], "-l")) {
- opt_l = 1;
- argc--;
- argv++;
- }
-
- if (argc < 2 || argc > 3)
- die("%s", usage);
-
- if (argc == 2) {
- struct url_info info;
- url1 = url_normalize(argv[1], &info);
- if (!url1)
- return 1;
- if (opt_p)
- printf("%s\n", url1);
- if (opt_l)
- printf("%u\n", (unsigned)info.url_len);
- return 0;
- }
-
- if (opt_p || opt_l)
- die("%s", usage);
-
- url1 = url_normalize(argv[1], NULL);
- url2 = url_normalize(argv[2], NULL);
- return (url1 && url2 && !strcmp(url1, url2)) ? 0 : 1;
-}