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

Change backticks to the more legible $()

This commit is contained in:
David Fetter
2017-10-28 10:51:59 -04:00
committed by Nico Williams
parent 68d0048148
commit 2ce1e323df
3 changed files with 20 additions and 20 deletions

View File

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

View File

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

View File

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