From 2ce1e323df8291e4d2fdb32e4bb85e525309c987 Mon Sep 17 00:00:00 2001 From: David Fetter Date: Sat, 28 Oct 2017 10:51:59 -0400 Subject: Change backticks to the more legible $() --- tests/setup | 2 +- tests/shtest | 36 ++++++++++++++++++------------------ tests/utf8test | 2 +- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/tests/setup b/tests/setup index 9ce382ba..4a96574d 100755 --- a/tests/setup +++ b/tests/setup @@ -35,7 +35,7 @@ clean () { fi } trap clean EXIT -d=`mktemp -d -t jqXXXXXX || true` +d=$(mktemp -d -t jqXXXXXX || true) if [ -z "$d" ]; then echo "Your OS does not support mktemp(1) -d" 1>&2 exit 1 diff --git a/tests/shtest b/tests/shtest index 80f7d1c9..86fec33e 100755 --- a/tests/shtest +++ b/tests/shtest @@ -29,45 +29,45 @@ $VALGRIND $Q $JQ -Rne '[inputs] == ["a\u0000b", "c\u0000d", "e"]' $d/input ## move all of these into tests/all.test # String constant folding (addition only) -nref=`$VALGRIND $Q $JQ -n --debug-dump-disasm '"foo"' | wc -l` +nref=$($VALGRIND $Q $JQ -n --debug-dump-disasm '"foo"' | wc -l) # Numeric constant folding (not all ops yet) -n=`$VALGRIND $Q $JQ -n --debug-dump-disasm '1+1' | wc -l` +n=$($VALGRIND $Q $JQ -n --debug-dump-disasm '1+1' | wc -l) if [ $n -ne $nref ]; then echo "Constant expression folding for strings didn't work" exit 1 fi -n=`$VALGRIND $Q $JQ -n --debug-dump-disasm '1-1' | wc -l` +n=$($VALGRIND $Q $JQ -n --debug-dump-disasm '1-1' | wc -l) if [ $n -ne $nref ]; then echo "Constant expression folding for strings didn't work" exit 1 fi -n=`$VALGRIND $Q $JQ -n --debug-dump-disasm '2*3' | wc -l` +n=$($VALGRIND $Q $JQ -n --debug-dump-disasm '2*3' | wc -l) if [ $n -ne $nref ]; then echo "Constant expression folding for strings didn't work" exit 1 fi -n=`$VALGRIND $Q $JQ -n --debug-dump-disasm '9/3' | wc -l` +n=$($VALGRIND $Q $JQ -n --debug-dump-disasm '9/3' | wc -l) if [ $n -ne $nref ]; then echo "Constant expression folding for strings didn't work" exit 1 fi -n=`$VALGRIND $Q $JQ -n --debug-dump-disasm '9==3' | wc -l` +n=$($VALGRIND $Q $JQ -n --debug-dump-disasm '9==3' | wc -l) if [ $n -ne $nref ]; then echo "Constant expression folding for strings didn't work" exit 1 fi -n=`$VALGRIND $Q $JQ -n --debug-dump-disasm '9!=3' | wc -l` +n=$($VALGRIND $Q $JQ -n --debug-dump-disasm '9!=3' | wc -l) if [ $n -ne $nref ]; then echo "Constant expression folding for strings didn't work" exit 1 fi -n=`$VALGRIND $Q $JQ -n --debug-dump-disasm '9<=3' | wc -l` +n=$($VALGRIND $Q $JQ -n --debug-dump-disasm '9<=3' | wc -l) if [ $n -ne $nref ]; then echo "Constant expression folding for strings didn't work" exit 1 fi -n=`$VALGRIND $Q $JQ -n --debug-dump-disasm '9>=3' | wc -l` +n=$($VALGRIND $Q $JQ -n --debug-dump-disasm '9>=3' | wc -l) if [ $n -ne $nref ]; then echo "Constant expression folding for strings didn't work" exit 1 @@ -145,15 +145,15 @@ if which seq > /dev/null 2>&1; then # test very, very slow when run with valgrind, and the whole point # is to run it with valgrind. # - #len=`wc -c < "$JQTESTDIR/torture/input0.json"` + #len=$(wc -c < "$JQTESTDIR/torture/input0.json") if [ -z "$VALGRIND" ]; then start=1 - end=`wc -c < "$JQTESTDIR/torture/input0.json"` + end=$(wc -c < "$JQTESTDIR/torture/input0.json") else start=120 end=151 fi - for i in `seq $start $end`; do + for i in $(seq $start $end); do dd "if=tests/torture/input0.json" bs=$i count=1 2>/dev/null | $VALGRIND $JQ -c . > $d/out0 2>$d/err || true if [ -n "$VALGRIND" ]; then @@ -178,7 +178,7 @@ fi ## Fuzz parser -## XXX With a `urandom` builtin we could move this test into tests/all.test +## XXX With a $(urandom) builtin we could move this test into tests/all.test clean=false if dd if=/dev/urandom bs=16 count=1024 > $d/rand 2>/dev/null; then # Have a /dev/urandom, good @@ -197,12 +197,12 @@ clean=true # Check handling of ~/.jq; these can't move into jq_test.c yet because # they depend on $HOME -if [ "`HOME="$mods" $VALGRIND $Q $JQ -nr fg`" != foobar ]; then +if [ "$(HOME="$mods" $VALGRIND $Q $JQ -nr fg)" != foobar ]; then echo "Bug #479 appears to be back" 1>&2 exit 1 fi -if [ `HOME="$mods" $VALGRIND $Q $JQ --debug-dump-disasm -n fg | grep '^[a-z]' | wc -l` -gt 3 ]; then +if [ $(HOME="$mods" $VALGRIND $Q $JQ --debug-dump-disasm -n fg | grep '^[a-z]' | wc -l) -gt 3 ]; then echo "Binding too many defs into program" 1>&2 exit 1 fi @@ -239,15 +239,15 @@ elif [ $? -ne 11 ]; then echo "jq halt_error(11) had wrong error code" 1>&2 exit 1 fi -if [ -n "`$VALGRIND $Q $JQ -n 'halt_error(1)' 2>&1`" ]; then +if [ -n "$($VALGRIND $Q $JQ -n 'halt_error(1)' 2>&1)" ]; then echo "jq halt_error(1) had unexpected output" 1>&2 exit 1 fi -if [ -n "`$VALGRIND $Q $JQ -n '"xyz\n"|halt_error(1)' 2>/dev/null`" ]; then +if [ -n "$($VALGRIND $Q $JQ -n '"xyz\n"|halt_error(1)' 2>/dev/null)" ]; then echo "jq halt_error(1) had unexpected output on stdout" 1>&2 exit 1 fi -if [ "`$VALGRIND $Q $JQ -n '"xyz\n"|halt_error(1)' 2>&1`" != xyz ]; then +if [ "$($VALGRIND $Q $JQ -n '"xyz\n"|halt_error(1)' 2>&1)" != xyz ]; then echo "jq halt_error(1) had unexpected output" 1>&2 exit 1 fi diff --git a/tests/utf8test b/tests/utf8test index 570731bb..a84b258f 100755 --- a/tests/utf8test +++ b/tests/utf8test @@ -2,7 +2,7 @@ . "${0%/*}/setup" "$@" -if [ "`$VALGRIND $Q $JQ -nf $JQTESTDIR/utf8-truncate.jq`" != "true" ]; then +if [ "$($VALGRIND $Q $JQ -nf $JQTESTDIR/utf8-truncate.jq)" != "true" ]; then echo "UTF-8 byte sequences that span the jv_load_file read buffer are mangled" exit 1 fi -- cgit v1.2.3