1
0
mirror of https://github.com/stedolan/jq.git synced 2024-05-11 05:55:39 +00:00

Test in-place functionality; fix #704

This commit is contained in:
Nicolas Williams
2015-02-18 18:01:12 -06:00
parent 3b8d08177f
commit c86ef36769
2 changed files with 6 additions and 1 deletions

2
main.c
View File

@@ -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);

View File

@@ -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