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:
committed by
Nico Williams
parent
68d0048148
commit
2ce1e323df
@@ -35,7 +35,7 @@ clean () {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
trap clean EXIT
|
trap clean EXIT
|
||||||
d=`mktemp -d -t jqXXXXXX || true`
|
d=$(mktemp -d -t jqXXXXXX || true)
|
||||||
if [ -z "$d" ]; then
|
if [ -z "$d" ]; then
|
||||||
echo "Your OS does not support mktemp(1) -d" 1>&2
|
echo "Your OS does not support mktemp(1) -d" 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
|
|||||||
36
tests/shtest
36
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
|
## move all of these into tests/all.test
|
||||||
|
|
||||||
# String constant folding (addition only)
|
# 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)
|
# 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
|
if [ $n -ne $nref ]; then
|
||||||
echo "Constant expression folding for strings didn't work"
|
echo "Constant expression folding for strings didn't work"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
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
|
if [ $n -ne $nref ]; then
|
||||||
echo "Constant expression folding for strings didn't work"
|
echo "Constant expression folding for strings didn't work"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
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
|
if [ $n -ne $nref ]; then
|
||||||
echo "Constant expression folding for strings didn't work"
|
echo "Constant expression folding for strings didn't work"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
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
|
if [ $n -ne $nref ]; then
|
||||||
echo "Constant expression folding for strings didn't work"
|
echo "Constant expression folding for strings didn't work"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
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
|
if [ $n -ne $nref ]; then
|
||||||
echo "Constant expression folding for strings didn't work"
|
echo "Constant expression folding for strings didn't work"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
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
|
if [ $n -ne $nref ]; then
|
||||||
echo "Constant expression folding for strings didn't work"
|
echo "Constant expression folding for strings didn't work"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
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
|
if [ $n -ne $nref ]; then
|
||||||
echo "Constant expression folding for strings didn't work"
|
echo "Constant expression folding for strings didn't work"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
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
|
if [ $n -ne $nref ]; then
|
||||||
echo "Constant expression folding for strings didn't work"
|
echo "Constant expression folding for strings didn't work"
|
||||||
exit 1
|
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
|
# test very, very slow when run with valgrind, and the whole point
|
||||||
# is to run it with valgrind.
|
# is to run it with valgrind.
|
||||||
#
|
#
|
||||||
#len=`wc -c < "$JQTESTDIR/torture/input0.json"`
|
#len=$(wc -c < "$JQTESTDIR/torture/input0.json")
|
||||||
if [ -z "$VALGRIND" ]; then
|
if [ -z "$VALGRIND" ]; then
|
||||||
start=1
|
start=1
|
||||||
end=`wc -c < "$JQTESTDIR/torture/input0.json"`
|
end=$(wc -c < "$JQTESTDIR/torture/input0.json")
|
||||||
else
|
else
|
||||||
start=120
|
start=120
|
||||||
end=151
|
end=151
|
||||||
fi
|
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 |
|
dd "if=tests/torture/input0.json" bs=$i count=1 2>/dev/null |
|
||||||
$VALGRIND $JQ -c . > $d/out0 2>$d/err || true
|
$VALGRIND $JQ -c . > $d/out0 2>$d/err || true
|
||||||
if [ -n "$VALGRIND" ]; then
|
if [ -n "$VALGRIND" ]; then
|
||||||
@@ -178,7 +178,7 @@ fi
|
|||||||
|
|
||||||
## Fuzz parser
|
## 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
|
clean=false
|
||||||
if dd if=/dev/urandom bs=16 count=1024 > $d/rand 2>/dev/null; then
|
if dd if=/dev/urandom bs=16 count=1024 > $d/rand 2>/dev/null; then
|
||||||
# Have a /dev/urandom, good
|
# 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
|
# Check handling of ~/.jq; these can't move into jq_test.c yet because
|
||||||
# they depend on $HOME
|
# 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
|
echo "Bug #479 appears to be back" 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
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
|
echo "Binding too many defs into program" 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@@ -239,15 +239,15 @@ elif [ $? -ne 11 ]; then
|
|||||||
echo "jq halt_error(11) had wrong error code" 1>&2
|
echo "jq halt_error(11) had wrong error code" 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
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
|
echo "jq halt_error(1) had unexpected output" 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
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
|
echo "jq halt_error(1) had unexpected output on stdout" 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
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
|
echo "jq halt_error(1) had unexpected output" 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
. "${0%/*}/setup" "$@"
|
. "${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"
|
echo "UTF-8 byte sequences that span the jv_load_file read buffer are mangled"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user