summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Dolan <mu@netsoc.tcd.ie>2012-09-04 20:56:44 +0100
committerStephen Dolan <mu@netsoc.tcd.ie>2012-09-04 20:56:44 +0100
commit58a9b0cfe135f6a7a274c1717702c10ac0e7ee5b (patch)
tree4b73772697e3305901015598e646deaa999c5aa5
parentda5d653de8920091fb689a85eabdfc2c34278b1b (diff)
Make the test harness not segfault when a test fails (!)
-rw-r--r--c/main.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/c/main.c b/c/main.c
index bad85418..b71bcad5 100644
--- a/c/main.c
+++ b/c/main.c
@@ -52,14 +52,16 @@ void run_tests() {
printf("Insufficient results\n");
pass = 0;
break;
- } else if (!jv_equal(expected, actual)) {
+ } else if (!jv_equal(jv_copy(expected), jv_copy(actual))) {
printf("Expected ");
- jv_dump(expected);
+ jv_dump(jv_copy(expected));
printf(", but got ");
- jv_dump(actual);
+ jv_dump(jv_copy(actual));
printf("\n");
pass = 0;
}
+ jv_free(expected);
+ jv_free(actual);
}
if (pass) {
jv extra = jq_next();