Skip to content

Commit

Permalink
XML pretty, add testcase
Browse files Browse the repository at this point in the history
  • Loading branch information
larshp committed Oct 13, 2023
1 parent abde463 commit 634cf13
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
},
"license": "MIT",
"dependencies": {
"@abaplint/cli": "^2.102.56",
"@abaplint/cli": "^2.102.57",
"@abaplint/runtime": "^2.7.105",
"@abaplint/database-sqlite": "^2.7.101",
"@abaplint/transpiler-cli": "^2.7.105"
Expand Down
19 changes: 19 additions & 0 deletions src/ixml/cl_ixml.clas.testclasses.abap
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ CLASS ltcl_xml DEFINITION FOR TESTING RISK LEVEL HARMLESS DURATION SHORT FINAL.
METHODS render_namespaced_attr FOR TESTING RAISING cx_static_check.
METHODS pretty1 FOR TESTING RAISING cx_static_check.
METHODS pretty2 FOR TESTING RAISING cx_static_check.
METHODS pretty3 FOR TESTING RAISING cx_static_check.

DATA mi_ixml TYPE REF TO if_ixml.
DATA mi_document TYPE REF TO if_ixml_document.
Expand Down Expand Up @@ -1040,4 +1041,22 @@ CLASS ltcl_xml IMPLEMENTATION.

ENDMETHOD.

METHOD pretty3.

DATA: lv_xstring TYPE xstring,
lv_actual TYPE string,
lv_expected TYPE string.


parse( |<foo><bar></bar></foo>| ).

lv_actual = pretty_print( ).
lv_expected = |<?xml version="1.0" encoding="utf-8"?>\n<foo>\n <bar/>\n</foo>\n|.

cl_abap_unit_assert=>assert_equals(
act = lv_actual
exp = lv_expected ).

ENDMETHOD.

ENDCLASS.

0 comments on commit 634cf13

Please sign in to comment.