| 1 |
--- a/test/cases/search.bats |
| 2 |
+++ b/test/cases/search.bats |
| 3 |
@@ -1,45 +1,45 @@ |
| 4 |
@test "Has valid help output" { |
| 5 |
- run ./jp --help |
| 6 |
+ run $JP --help |
| 7 |
[ "$status" -eq 0 ] |
| 8 |
echo $output | grep "\-\-filename" |
| 9 |
} |
| 10 |
|
| 11 |
@test "Can display version" { |
| 12 |
- run ./jp --version |
| 13 |
+ run $JP --version |
| 14 |
[ "$status" -eq 0 ] |
| 15 |
} |
| 16 |
|
| 17 |
@test "Can search basic expression" { |
| 18 |
- output=$(echo '{"foo": "bar"}' | ./jp foo) |
| 19 |
+ output=$(echo '{"foo": "bar"}' | $JP foo) |
| 20 |
[ "$output" == "\"bar\"" ] |
| 21 |
} |
| 22 |
|
| 23 |
@test "Can search subexpr expression" { |
| 24 |
- output=$(echo '{"foo": {"bar": "baz"}}' | ./jp foo.bar) |
| 25 |
+ output=$(echo '{"foo": {"bar": "baz"}}' | $JP foo.bar) |
| 26 |
[ "$output" == "\"baz\"" ] |
| 27 |
} |
| 28 |
|
| 29 |
@test "Can read input from file" { |
| 30 |
echo '{"foo": "bar"}' > "$BATS_TMPDIR/input.json" |
| 31 |
- run ./jp -f "$BATS_TMPDIR/input.json" foo |
| 32 |
+ run $JP -f "$BATS_TMPDIR/input.json" foo |
| 33 |
[ "$output" == "\"bar\"" ] |
| 34 |
} |
| 35 |
|
| 36 |
@test "Can print result unquoted" { |
| 37 |
- output=$(echo '{"foo": "bar"}' | ./jp -u foo) |
| 38 |
+ output=$(echo '{"foo": "bar"}' | $JP -u foo) |
| 39 |
[ "$output" == "bar" ] |
| 40 |
} |
| 41 |
|
| 42 |
@test "Bad JMESPath expression has non zero rc" { |
| 43 |
echo '{"foo": "bar"}' > "$BATS_TMPDIR/input.json" |
| 44 |
- run ./jp -f "$BATS_TMPDIR/input.json" "bax[expre]ssion" |
| 45 |
+ run $JP -f "$BATS_TMPDIR/input.json" "bax[expre]ssion" |
| 46 |
[ "$status" -eq 1 ] |
| 47 |
} |
| 48 |
|
| 49 |
@test "Large numbers are not printed with scientific notation" { |
| 50 |
skip |
| 51 |
echo '{"foo": 47268765}' > "$BATS_TMPDIR/input.json" |
| 52 |
- run ./jp -f "$BATS_TMPDIR/input.json" "foo" |
| 53 |
+ run $JP -f "$BATS_TMPDIR/input.json" "foo" |
| 54 |
[ "$status" -eq 0 ] |
| 55 |
[ "$output" == "47268765" ] |
| 56 |
} |
| 57 |
@@ -47,12 +47,12 @@ |
| 58 |
@test "Can accept expression from file" { |
| 59 |
echo 'foo.bar' > "$BATS_TMPDIR/expr" |
| 60 |
echo '{"foo": {"bar": "baz"}}' > "$BATS_TMPDIR/input.json" |
| 61 |
- run ./jp -u -f "$BATS_TMPDIR/input.json" -e "$BATS_TMPDIR/expr" |
| 62 |
+ run $JP -u -f "$BATS_TMPDIR/input.json" -e "$BATS_TMPDIR/expr" |
| 63 |
[ "$output" == "baz" ] |
| 64 |
} |
| 65 |
|
| 66 |
@test "Can pretty print expr AST" { |
| 67 |
- run ./jp --ast "foo" |
| 68 |
+ run $JP --ast "foo" |
| 69 |
expected=' |
| 70 |
ASTField { |
| 71 |
value: "foo" |
| 72 |
@@ -65,7 +65,7 @@ |
| 73 |
@test "Can sort int array" { |
| 74 |
echo '[2,1,3,5,4]' > "$BATS_TMPDIR/input.json" |
| 75 |
echo "sort(@) | map(&to_string(@), @) | join('', @)" > "$BATS_TMPDIR/expr" |
| 76 |
- run ./jp -u -f "$BATS_TMPDIR/input.json" -e "$BATS_TMPDIR/expr" |
| 77 |
+ run $JP -u -f "$BATS_TMPDIR/input.json" -e "$BATS_TMPDIR/expr" |
| 78 |
[ "$status" -eq 0 ] |
| 79 |
[ "$output" == "12345" ] |
| 80 |
} |