summaryrefslogtreecommitdiffstats
path: root/jq_test.c
diff options
context:
space:
mode:
authorNicolas Williams <nico@cryptonector.com>2013-06-15 01:55:47 -0500
committerNicolas Williams <nico@cryptonector.com>2013-06-15 17:37:15 -0500
commit0ed6347d47e68c0bba4b93fae9028e84ec64b4b6 (patch)
tree558b5827137ac7346cca6b7e54382cef240881b9 /jq_test.c
parent3f86e97f709d222fc79f4e7b096af40782ea8775 (diff)
Allow --run-tests to take a file argument
Diffstat (limited to 'jq_test.c')
-rw-r--r--jq_test.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/jq_test.c b/jq_test.c
index 199a3bc4..f0f77f56 100644
--- a/jq_test.c
+++ b/jq_test.c
@@ -10,8 +10,16 @@ static void run_jq_tests();
int jq_testsuite(int argc, char* argv[]) {
+ FILE *testdata = stdin;
jv_test();
- run_jq_tests(stdin);
+ if (argc > 2) {
+ testdata = fopen(argv[2], "re");
+ if (!testdata) {
+ perror("fopen");
+ exit(1);
+ }
+ }
+ run_jq_tests(testdata);
return 0;
}