libubox: Add ability to find ordinal position inside a table#33
libubox: Add ability to find ordinal position inside a table#33openwrt-bot merged 1 commit intoopenwrt:masterfrom
Conversation
|
cc: @robimarko @ynezz |
61fbf8b to
4ba903d
Compare
|
@ynezz Any idea why the test is failing with: It looks like a problem with setup or teardown of the test. Trying to go by your example, it calls cc: @Noltari |
@pprindeville adding test_jshn_get_index() {
JSON_PREFIX="${JSON_PREFIX:-}"
. ../../sh/jshn.sh
set +u
local index
json_init
json_add_object "Dhcp4"
json_add_array "subnet4"
json_add_object ""
json_get_index index
json_add_int "id" 1
json_add_string "subnet" "192.168.1.0/24"
json_close_object
json_add_object ""
json_add_int "id" 2
json_add_string "subnet" "192.168.2.0/24"
json_close_object
json_select "$index" # revisit first anonymous object
json_add_int "valid-lifetime" 3600
json_select .. # pop back into array
json_close_array # subnet4
json_close_object # Dhcp4
local json="$(json_dump)"
assertEquals '{ "Dhcp4": { "subnet4": [ { "id": 1, "subnet": "192.168.1.0\/24", "valid-lifetime": 3600 }, { "id": 2, "subnet": "192.168.2.0\/24" } ] } }' "$json"
set -u
}(And removing one of the double |
|
@pprindeville you need to rebase it on top of #34 in order to get it working. |
2204038 to
f6c19dd
Compare
f6c19dd to
b846d54
Compare
52309f9 to
6f6958b
Compare
|
@pprindeville I rebased your branch on top of master, and made some minor changes. |
When adding anonymous objects to an array, the only way to select those objects (as in "json_select", i.e. moving the cursor) is to select them via their ordinality. This function returns a selectable index to those objects. Signed-off-by: Philip Prindeville <[email protected]> Link: openwrt#33 Signed-off-by: Álvaro Fernández Rojas <[email protected]>
6f6958b to
15f742a
Compare
When adding anonymous objects to an array, the only way to select those objects (as in "json_select", i.e. moving the cursor) is to select them via their ordinality. This function returns a selectable index to those objects. Signed-off-by: Philip Prindeville <[email protected]> Link: openwrt#33 Signed-off-by: Álvaro Fernández Rojas <[email protected]>
15f742a to
500cd85
Compare
@Noltari Understood. Given that getting traction on this package has been challenging, and that the new function isn't callable anywhere else but by Kea, should we merge it in the absence of objections in... say... 2 weeks? |
When adding anonymous objects to an array, the only way to select those objects (as in "json_select", i.e. moving the cursor) is to select them via their ordinality. This function returns a selectable index to those objects. Signed-off-by: Philip Prindeville <[email protected]> Link: openwrt#33 Signed-off-by: Álvaro Fernández Rojas <[email protected]>
500cd85 to
abc37c8
Compare
|
go for it |
When adding anonymous objects to an array, the only way to select those objects (as in "json_select", i.e. moving the cursor) is to select them via their ordinality. This function returns a selectable index to those objects. Signed-off-by: Philip Prindeville <[email protected]> Link: openwrt#33 Signed-off-by: Álvaro Fernández Rojas <[email protected]>
abc37c8 to
7928f17
Compare
|
Merged, thanks @pprindeville |
When adding anonymous objects to an array, the only way to select them (as in
json_select) is via their ordinality. This function returns a selectable index to those members.