Skip to content
Merged
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
21 changes: 21 additions & 0 deletions tests/shunit2/tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -452,4 +452,25 @@ test_jshn_add_multi() {
set -u
}

test_jshn_append_via_json_script() {
JSON_PREFIX="${JSON_PREFIX:-}"
. ../../sh/jshn.sh

# __SHUNIT_SHELL_FLAGS='u' results in 'line 6: JSON_UNSET: unbound variable' in json_cleanup()
set +u

# Test appending first key to empty variable without leading space
json_init
json_add_string "first" "value1"
json_get_keys keys
assertEquals "first" "$keys"

# Test appending second key should maintain no leading space on first key
json_add_string "second" "value2"
json_get_keys keys
assertEquals "first second" "$keys"

set -u
}

. ./shunit2/shunit2