Skip to content

Commit

Permalink
fix: Run e2e without colors
Browse files Browse the repository at this point in the history
  • Loading branch information
davesnx committed Sep 14, 2020
1 parent cc925fb commit fac51e5
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
2 changes: 1 addition & 1 deletion bin/Info.re
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
let version = "0.3.4";
let version = "0.3.5";
let description = "query-json is a faster and simpler re-implementation of jq in Reason Native, available under 'q'";

let repo = "https://github.com/davesnx/query-json";
Expand Down
20 changes: 15 additions & 5 deletions e2e/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,35 @@ function q () {
echo "Running in CI mode"
run ./q "$@"
else
chmod +x "$BATS_TEST_DIRNAME/../_build/default/bin/q.exe"
run "$BATS_TEST_DIRNAME/../_build/default/bin/q.exe" "$@"
chmod +x _build/default/bin/q.exe
run "_build/default/bin/q.exe" "$@"
fi
}

@test "json call works ok" {
q '.first.name' $BATS_TEST_DIRNAME/mock.json
q --no-color '.first.name' e2e/mock.json
[ "$status" -eq 0 ]
[ "$output" = '"John Doe"' ]
}

@test "inline call works ok" {
q --kind="inline" '.' '{ "a": 1 }'
q --kind="inline" --no-color '.' '{ "a": 1 }'
[ "$status" -eq 0 ]
[ "$output" = '{ "a": 1 }' ]
}

@test "non defined field gives back null" {
q '.wat?' $BATS_TEST_DIRNAME/mock.json
q --no-color '.wat?' e2e/mock.json
[ "$status" -eq 0 ]
[ "$output" = "null" ]
}

teardown () {
echo "$BATS_TEST_NAME
--------
$output
--------
"
}
2 changes: 1 addition & 1 deletion esy.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@davesnx/query-json",
"version": "0.3.4",
"version": "0.3.5",
"description": "faster and simpler re-implementation of jq in Reason Native",
"author": "davesnx <[email protected]>",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion source/Json.re
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ let (pp_print_string, pp_print_bool, pp_print_list, fprintf, asprintf) =
*/

let parseFile = Yojson.Basic.from_file;
let parseString = Yojson.Basic.from_file;
let parseString = Yojson.Basic.from_string;

let string = str => {
let buf = Buffer.create(String.length(str) * 5 / 4);
Expand Down

0 comments on commit fac51e5

Please sign in to comment.