Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions bash-env-json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.

VERSION="0.10.0a1"
VERSION="0.10.0a2"
USAGE="bash-env-json [--help] [--shellfns <comma-separated-function-names>] [path]"

shopt -s extglob
Expand Down Expand Up @@ -63,7 +63,7 @@ function capture() {
function emit_value() {
# `jq -R` produces nothing on empty input, but we want ""
if test -n "$1"; then
echo -n "$1" | _jq -R
echo -n "$1" | _jq -Rs
else
echo -n '""'
fi
Expand Down
7 changes: 5 additions & 2 deletions tests.bats
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function test_case() {
echo "$@"

# sort and remove `meta` before comparison with expected output
bash-env-json "$@" "$_test_file" | jq --sort-keys 'del(.meta)' | diff -w - "$_expected_output"
./bash-env-json "$@" "$_test_file" | jq --sort-keys 'del(.meta)' | diff -w - "$_expected_output"
}

@test "empty" {
Expand All @@ -40,11 +40,14 @@ function test_case() {
test_case "Ming's menu of (merciless) monstrosities"
}

@test "multiline-string" {
test_case multiline-string
}

@test "error" {
test_case error
}


@test "shell-function-error" {
test_case shell-function-error --shellfns f
}
3 changes: 3 additions & 0 deletions tests/multiline-string.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export MULTILINE="a
b
c"
6 changes: 6 additions & 0 deletions tests/multiline-string.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"env": {
"MULTILINE": "a\nb\nc"
},
"shellvars": { }
}
1 change: 1 addition & 0 deletions tests/multiline-string.setup.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
unset MULTILINE
Loading