mirror of
https://github.com/abapGit/abapGit.git
synced 2025-04-30 11:46:38 +08:00
ajson, Automatic Update (#6827)
Co-authored-by: larshp <larshp@users.noreply.github.com> Co-authored-by: Lars Hvam <larshp@hotmail.com>
This commit is contained in:
parent
687e43137c
commit
6f8a136cde
|
@ -924,8 +924,12 @@ CLASS zcl_abapgit_ajson IMPLEMENTATION.
|
|||
ls_new_node-name = ls_split_path-name.
|
||||
ls_new_node-type = zif_abapgit_ajson_types=>node_type-array.
|
||||
|
||||
IF ms_opts-keep_item_order = abap_true AND ls_deleted_node IS NOT INITIAL.
|
||||
ls_new_node-order = ls_deleted_node-order.
|
||||
IF ms_opts-keep_item_order = abap_true.
|
||||
IF ls_deleted_node IS NOT INITIAL.
|
||||
ls_new_node-order = ls_deleted_node-order.
|
||||
ELSE.
|
||||
ls_new_node-order = lr_parent->children.
|
||||
ENDIF.
|
||||
ENDIF.
|
||||
|
||||
INSERT ls_new_node INTO TABLE mt_json_tree.
|
||||
|
|
|
@ -2198,6 +2198,7 @@ CLASS ltcl_writer_test DEFINITION FINAL
|
|||
METHODS read_only FOR TESTING RAISING zcx_abapgit_ajson_error.
|
||||
METHODS set_array_obj FOR TESTING RAISING zcx_abapgit_ajson_error.
|
||||
METHODS set_with_type FOR TESTING RAISING zcx_abapgit_ajson_error.
|
||||
METHODS new_array_w_keep_order_touch FOR TESTING RAISING zcx_abapgit_ajson_error.
|
||||
METHODS overwrite_w_keep_order_touch FOR TESTING RAISING zcx_abapgit_ajson_error.
|
||||
METHODS overwrite_w_keep_order_set FOR TESTING RAISING zcx_abapgit_ajson_error.
|
||||
METHODS setx FOR TESTING RAISING zcx_abapgit_ajson_error.
|
||||
|
@ -3271,6 +3272,37 @@ CLASS ltcl_writer_test IMPLEMENTATION.
|
|||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD new_array_w_keep_order_touch.
|
||||
|
||||
DATA li_cut TYPE REF TO zif_abapgit_ajson.
|
||||
|
||||
" default order adds new arrays at beginning of node (pos 0)
|
||||
li_cut = zcl_abapgit_ajson=>create_empty(
|
||||
)->set(
|
||||
iv_path = '/b'
|
||||
iv_val = 1 ).
|
||||
|
||||
li_cut->touch_array( '/a' ).
|
||||
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
act = li_cut->stringify( )
|
||||
exp = '{"a":[],"b":1}' ).
|
||||
|
||||
" with keep order, new array is created at end of node
|
||||
li_cut = zcl_abapgit_ajson=>create_empty(
|
||||
)->keep_item_order(
|
||||
)->set(
|
||||
iv_path = '/b'
|
||||
iv_val = 1 ).
|
||||
|
||||
li_cut->touch_array( '/a' ).
|
||||
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
act = li_cut->stringify( )
|
||||
exp = '{"b":1,"a":[]}' ).
|
||||
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD overwrite_w_keep_order_touch.
|
||||
|
||||
DATA li_cut TYPE REF TO zif_abapgit_ajson.
|
||||
|
|
Loading…
Reference in New Issue
Block a user