mirror of
https://github.com/json-c/json-c.git
synced 2026-04-02 03:49:06 +08:00
Rewrite json_object_object_add to replace just the value if the key already exists so keys remain valid.
This is particularly useful when replacing values in a loop, since it allows the key used by json_object_object_foreach to continue to be used.
This commit is contained in:
12
tests/testReplaceExisting.test
Executable file
12
tests/testReplaceExisting.test
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Common definitions
|
||||
if test -z "$srcdir"; then
|
||||
srcdir="${0%/*}"
|
||||
test "$srcdir" = "$0" && srcdir=.
|
||||
test -z "$srcdir" && srcdir=.
|
||||
fi
|
||||
. "$srcdir/test-defs.sh"
|
||||
|
||||
run_output_test testReplaceExisting
|
||||
exit $?
|
||||
Reference in New Issue
Block a user