Skip to content

Commit

Permalink
Added tests for --compact-output and --indent options
Browse files Browse the repository at this point in the history
  • Loading branch information
gbrlmarn authored and itchyny committed Nov 12, 2024
1 parent dad7dd6 commit 954a4ea
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions tests/shtest
Original file line number Diff line number Diff line change
Expand Up @@ -725,4 +725,33 @@ $VALGRIND $Q $JQ . <<\NUM
-10E-1000000001
NUM

# test for --indent and --compact-output -- #1465
printf '[1,2]\n' > $d/expected
$JQ --compact-output -n "[1,2]" > $d/out
cmp $d/out $d/expected

printf '[\n1,\n2\n]\n' > $d/expected
$JQ --indent 0 -n "[1,2]" > $d/out
cmp $d/out $d/expected

printf '[\n 1,\n 2\n]\n' > $d/expected
$JQ --indent 1 -n "[1,2]" > $d/out
cmp $d/out $d/expected

printf '[\n 1,\n 2\n]\n' > $d/expected
$JQ --indent 5 -n "[1,2]" > $d/out
cmp $d/out $d/expected

printf '[\n{\n"a": 1\n}\n]\n' > $d/expected
$JQ --indent 0 -n "[{a:1}]" > $d/out
cmp $d/out $d/expected

printf '[\n {\n "a": 1\n }\n]\n' > $d/expected
$JQ --indent 1 -n "[{a:1}]" > $d/out
cmp $d/out $d/expected

printf '[\n {\n "a": 1\n }\n]\n' > $d/expected
$JQ --indent 6 -n "[{a:1}]" > $d/out
cmp $d/out $d/expected

exit 0

0 comments on commit 954a4ea

Please sign in to comment.