From e6e7530d10b74d763b4311ea93e0a831b810d6c2 Mon Sep 17 00:00:00 2001 From: Nguyễn Thái Ngọc Duy Date: Wed, 13 Apr 2016 20:22:42 +0700 Subject: test helpers: move test-* to t/helper/ subdirectory MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Junio C Hamano --- test-parse-options.c | 104 --------------------------------------------------- 1 file changed, 104 deletions(-) delete mode 100644 test-parse-options.c (limited to 'test-parse-options.c') diff --git a/test-parse-options.c b/test-parse-options.c deleted file mode 100644 index 2c8c8f18ed..0000000000 --- a/test-parse-options.c +++ /dev/null @@ -1,104 +0,0 @@ -#include "cache.h" -#include "parse-options.h" -#include "string-list.h" - -static int boolean = 0; -static int integer = 0; -static unsigned long magnitude = 0; -static unsigned long timestamp; -static int abbrev = 7; -static int verbose = 0, dry_run = 0, quiet = 0; -static char *string = NULL; -static char *file = NULL; -static int ambiguous; -static struct string_list list; - -static int length_callback(const struct option *opt, const char *arg, int unset) -{ - printf("Callback: \"%s\", %d\n", - (arg ? arg : "not set"), unset); - if (unset) - return 1; /* do not support unset */ - - *(int *)opt->value = strlen(arg); - return 0; -} - -static int number_callback(const struct option *opt, const char *arg, int unset) -{ - *(int *)opt->value = strtol(arg, NULL, 10); - return 0; -} - -int main(int argc, char **argv) -{ - const char *prefix = "prefix/"; - const char *usage[] = { - "test-parse-options ", - NULL - }; - struct option options[] = { - OPT_BOOL(0, "yes", &boolean, "get a boolean"), - OPT_BOOL('D', "no-doubt", &boolean, "begins with 'no-'"), - { OPTION_SET_INT, 'B', "no-fear", &boolean, NULL, - "be brave", PARSE_OPT_NOARG | PARSE_OPT_NONEG, NULL, 1 }, - OPT_COUNTUP('b', "boolean", &boolean, "increment by one"), - OPT_BIT('4', "or4", &boolean, - "bitwise-or boolean with ...0100", 4), - OPT_NEGBIT(0, "neg-or4", &boolean, "same as --no-or4", 4), - OPT_GROUP(""), - OPT_INTEGER('i', "integer", &integer, "get a integer"), - OPT_INTEGER('j', NULL, &integer, "get a integer, too"), - OPT_MAGNITUDE('m', "magnitude", &magnitude, "get a magnitude"), - OPT_SET_INT(0, "set23", &integer, "set integer to 23", 23), - OPT_DATE('t', NULL, ×tamp, "get timestamp of