From 167a3b968adb0186fa7ddf29f9c25f369771842d Mon Sep 17 00:00:00 2001 From: Lars Hvam Date: Wed, 7 Aug 2024 18:22:35 +0200 Subject: [PATCH 1/3] add testcase --- src/ixml/cl_ixml.clas.testclasses.abap | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/ixml/cl_ixml.clas.testclasses.abap b/src/ixml/cl_ixml.clas.testclasses.abap index a2c75208..76dbbed3 100644 --- a/src/ixml/cl_ixml.clas.testclasses.abap +++ b/src/ixml/cl_ixml.clas.testclasses.abap @@ -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. @@ -168,6 +169,27 @@ CLASS ltcl_xml IMPLEMENTATION. exp = '' ). 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 = 'b' + value = 'value' ). + lo_element->set_attribute( + name = 'a' + value = 'value' ). + lv_xml = render( ). + + cl_abap_unit_assert=>assert_equals( + act = lv_xml + exp = '' ). + ENDMETHOD. + METHOD render_element_and_attribute. DATA lo_element TYPE REF TO if_ixml_element. DATA lv_xml TYPE string. From b54d07bfd1b2b4335ba9ea1e92dc0998cc14a26a Mon Sep 17 00:00:00 2001 From: Lars Hvam Date: Wed, 7 Aug 2024 18:34:34 +0200 Subject: [PATCH 2/3] update --- src/ixml/cl_ixml.clas.testclasses.abap | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/ixml/cl_ixml.clas.testclasses.abap b/src/ixml/cl_ixml.clas.testclasses.abap index 76dbbed3..b35923ee 100644 --- a/src/ixml/cl_ixml.clas.testclasses.abap +++ b/src/ixml/cl_ixml.clas.testclasses.abap @@ -178,16 +178,19 @@ CLASS ltcl_xml IMPLEMENTATION. name = 'moo' parent = mi_document ). lo_element->set_attribute( - name = 'b' + name = 't' value = 'value' ). lo_element->set_attribute( - name = 'a' + 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 = '' ). + exp = '' ). ENDMETHOD. METHOD render_element_and_attribute. From 185035ae78dea56a55cccae3648725d92568804f Mon Sep 17 00:00:00 2001 From: Lars Hvam Date: Wed, 7 Aug 2024 18:53:20 +0200 Subject: [PATCH 3/3] add testcase --- ...nel_call_transformation.clas.testclasses.abap | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/kernel/call_transformation/kernel_call_transformation.clas.testclasses.abap b/src/kernel/call_transformation/kernel_call_transformation.clas.testclasses.abap index ab15d497..956f00fc 100644 --- a/src/kernel/call_transformation/kernel_call_transformation.clas.testclasses.abap +++ b/src/kernel/call_transformation/kernel_call_transformation.clas.testclasses.abap @@ -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. @@ -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 = ||. + 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 = '**' ). + + ENDMETHOD. + ENDCLASS. \ No newline at end of file