Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ixml: add testcase #902

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
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
25 changes: 25 additions & 0 deletions src/ixml/cl_ixml.clas.testclasses.abap
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ CLASS ltcl_xml DEFINITION FOR TESTING RISK LEVEL HARMLESS DURATION SHORT FINAL.
METHODS render_element_and_attribute FOR TESTING RAISING cx_static_check.
METHODS render_element_and_two_attribu FOR TESTING RAISING cx_static_check.
METHODS render_attribute FOR TESTING RAISING cx_static_check.
METHODS render_attribute_multi FOR TESTING RAISING cx_static_check.
METHODS render_value FOR TESTING RAISING cx_static_check.
METHODS render_escape FOR TESTING RAISING cx_static_check.
METHODS render_nested FOR TESTING RAISING cx_static_check.
Expand Down Expand Up @@ -168,6 +169,30 @@ CLASS ltcl_xml IMPLEMENTATION.
exp = '<?xml version="1.0" encoding="utf-16"?><hello:moo name="value"/>' ).
ENDMETHOD.

METHOD render_attribute_multi.
DATA lo_element TYPE REF TO if_ixml_element.
DATA lv_xml TYPE string.

lo_element = mi_document->create_simple_element_ns(
prefix = 'hello'
name = 'moo'
parent = mi_document ).
lo_element->set_attribute(
name = 't'
value = 'value' ).
lo_element->set_attribute(
name = 'si'
value = 'value' ).
lo_element->set_attribute(
name = 'ref'
value = 'value' ).
lv_xml = render( ).

cl_abap_unit_assert=>assert_equals(
act = lv_xml
exp = '<?xml version="1.0" encoding="utf-16"?><hello:moo t="value" si="value" ref="value"/>' ).
ENDMETHOD.

METHOD render_element_and_attribute.
DATA lo_element TYPE REF TO if_ixml_element.
DATA lv_xml TYPE string.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ CLASS ltcl_call_transformation DEFINITION FOR TESTING RISK LEVEL HARMLESS DURATI
METHODS xml_to_xml FOR TESTING RAISING cx_static_check.
METHODS xml_to_xml_rm_header FOR TESTING RAISING cx_static_check.
METHODS xml_to_xml_rm_header_bom FOR TESTING RAISING cx_static_check.
METHODS xml_to_xml_sort_attributes FOR TESTING RAISING cx_static_check.
ENDCLASS.

CLASS ltcl_call_transformation IMPLEMENTATION.
Expand Down Expand Up @@ -1142,4 +1143,19 @@ CLASS ltcl_call_transformation IMPLEMENTATION.

ENDMETHOD.

METHOD xml_to_xml_sort_attributes.

DATA lv_xml TYPE string.
DATA lv_str_bom TYPE string.
DATA lv_hex_bom TYPE xstring.

lv_xml = |<hello:moo t="value" si="value" ref="value"/>|.
CALL TRANSFORMATION id SOURCE XML lv_xml RESULT XML lv_xml OPTIONS xml_header = 'no'.

cl_abap_unit_assert=>assert_char_cp(
act = lv_xml
exp = '*<hello:moo ref="value" si="value" t="value"/>*' ).

ENDMETHOD.

ENDCLASS.
Loading