fix format empty xml attributes

This commit is contained in:
Christian Guenter 2018-06-04 07:02:15 +00:00 committed by Christian Guenter
parent 71787d74f0
commit 6812fd56f6
2 changed files with 18 additions and 2 deletions

View File

@ -21,7 +21,7 @@ CLASS zcl_abapgit_syntax_xml DEFINITION
BEGIN OF c_regex,
xml_tag TYPE string VALUE '[<>]', "#EC NOTEXT
attr TYPE string VALUE '\s[-a-z:_0-9]+\s*(?==)', "#EC NOTEXT
attr_val TYPE string VALUE '["''][^''"]+[''"]', "#EC NOTEXT
attr_val TYPE string VALUE '["''][^''"]*[''"]', "#EC NOTEXT
END OF c_regex .
METHODS constructor .

View File

@ -12,7 +12,8 @@ CLASS abapgit_syntax_xml DEFINITION FINAL FOR TESTING
setup,
sole_closing_xml_tag FOR TESTING RAISING cx_static_check,
complete_xml_tag FOR TESTING RAISING cx_static_check,
complete_xml_tag_with_closing FOR TESTING RAISING cx_static_check.
complete_xml_tag_with_closing FOR TESTING RAISING cx_static_check,
empty_attributes FOR TESTING RAISING cx_static_check.
ENDCLASS.
@ -49,4 +50,19 @@ CLASS abapgit_syntax_xml IMPLEMENTATION.
ENDMETHOD.
METHOD empty_attributes.
cl_abap_unit_assert=>assert_equals(
exp = |<span class="xml_tag">&lt;ECTD</span>|
&& |<span class="attr"> SAPRL</span>=|
&& |<span class="attr_val">&quot;751&quot;</span>|
&& |<span class="attr"> VERSION</span>=|
&& |<span class="attr_val">&quot;1.5&quot;</span>|
&& |<span class="attr"> DOWNLOADDATE</span>=<span class="attr_val">&quot;&quot;</span>|
&& |<span class="attr"> DOWNLOADTIME</span>=<span class="attr_val">&quot;&quot;</span>|
&& |<span class="xml_tag">&gt;</span>|
act = mo_cut->process_line( |<ECTD SAPRL="751" VERSION="1.5" DOWNLOADDATE="" DOWNLOADTIME="">| ) ).
ENDMETHOD.
ENDCLASS.