mirror of
https://github.com/stedolan/jq.git
synced 2024-05-11 05:55:39 +00:00
Fix --run-tests arg handling
This commit is contained in:
@@ -12,8 +12,8 @@ static void run_jq_tests();
|
||||
int jq_testsuite(jv libdirs, int argc, char* argv[]) {
|
||||
FILE *testdata = stdin;
|
||||
jv_test();
|
||||
if (argc > 2) {
|
||||
testdata = fopen(argv[2], "r");
|
||||
if (argc > 0) {
|
||||
testdata = fopen(argv[0], "r");
|
||||
if (!testdata) {
|
||||
perror("fopen");
|
||||
exit(1);
|
||||
|
5
main.c
5
main.c
@@ -419,8 +419,11 @@ int main(int argc, char* argv[]) {
|
||||
goto out;
|
||||
}
|
||||
if (isoption(argv[i], 0, "run-tests", &short_opts)) {
|
||||
i++;
|
||||
// XXX Pass program_arguments, even a whole jq_state *, through;
|
||||
// could be useful for testing
|
||||
jv_free(program_arguments);
|
||||
ret = jq_testsuite(lib_search_paths, argc - i, argv + i + 1);
|
||||
ret = jq_testsuite(lib_search_paths, argc - i, argv + i);
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user