From c86ef36769a6bec0d77357203d18aa347e16fb1e Mon Sep 17 00:00:00 2001 From: Nicolas Williams Date: Wed, 18 Feb 2015 18:01:12 -0600 Subject: [PATCH] Test in-place functionality; fix #704 --- main.c | 2 +- tests/run | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/main.c b/main.c index 5627eca4..76525723 100644 --- a/main.c +++ b/main.c @@ -515,7 +515,7 @@ int main(int argc, char* argv[]) { fprintf(stderr, "Error: %s opening /dev/null\n", strerror(errno)); exit(3); } - assert(first_file != 0 && !strcmp(first_file, "-")); + assert(first_file != 0 && strcmp(first_file, "-") != 0); if (rename(t, first_file) == -1) { fprintf(stderr, "Error: %s renaming temporary file\n", strerror(errno)); exit(3); diff --git a/tests/run b/tests/run index bb7d0727..3250b33a 100755 --- a/tests/run +++ b/tests/run @@ -129,6 +129,11 @@ EOF printf '1\n'|./jq -ces --seq '. == [1]' >/dev/null 2> $d/out cmp $d/out $d/expected +$VALGRIND $Q ./jq -n '0, 1, 2' > $d/a +$VALGRIND $Q ./jq -n '3, 4, 5' > $d/b +$VALGRIND $Q ./jq -i '.+1' $d/a $d/b +$VALGRIND $Q ./jq -se '. == [1,2,3,4,5,6]' $d/a + ## Test streaming parser ## If we add an option to stream to the `import ... as $symbol;` directive