diff options
author | Stephen Dolan <mu@netsoc.tcd.ie> | 2013-05-11 15:21:23 +0100 |
---|---|---|
committer | Stephen Dolan <mu@netsoc.tcd.ie> | 2013-05-11 15:21:23 +0100 |
commit | 7ca5127fcc74ec2c58c1ad01de57d1c5ec00b827 (patch) | |
tree | 07985ebf2a44abb7dd0193e7a48e5c141f8004c4 /jq_test.c | |
parent | 7813f363a20817c8b0429f53e4740d6ed852e527 (diff) | |
parent | 4b1b9c219a37488e4b113e87216da121671b2297 (diff) |
Merge branch 'autotools'
Diffstat (limited to 'jq_test.c')
-rw-r--r-- | jq_test.c | 21 |
1 files changed, 2 insertions, 19 deletions
@@ -8,30 +8,13 @@ static void jv_test(); static void run_jq_tests(); -FILE* testdata; int jq_testsuite(int argc, char* argv[]) { jv_test(); - if (argc == 1) { - testdata = fopen("testdata", "r"); - } else if (argc == 2) { - if (!strcmp(argv[1], "-")) { - testdata = stdin; - } else { - testdata = fopen(argv[1], "r"); - } - } else { - printf("usage: %s OR cat testdata | %s - OR %s testdata\n", argv[0], argv[0], argv[0]); - return 127; - } - run_jq_tests(); - if (testdata != stdin) fclose(testdata); + run_jq_tests(stdin); return 0; } - - - static int skipline(const char* buf) { int p = 0; while (buf[p] == ' ' || buf[p] == '\t') p++; @@ -39,7 +22,7 @@ static int skipline(const char* buf) { return 0; } -static void run_jq_tests() { +static void run_jq_tests(FILE *testdata) { char buf[4096]; int tests = 0, passed = 0, invalid = 0; jq_state *jq = NULL; |