mirror of
https://github.com/abapGit/abapGit.git
synced 2025-04-30 11:46:38 +08:00
Fix unit tests for non-Unicode systems
Ref https://github.com/abapGit/abapGit/issues/7142#issuecomment-2643044612
This commit is contained in:
parent
188bf8d69a
commit
89cfdf123a
|
@ -284,6 +284,11 @@ CLASS ltcl_convert IMPLEMENTATION.
|
|||
|
||||
DATA lv_result TYPE string.
|
||||
|
||||
" Test does not work on non-Unicode but is not important for real-world anyway
|
||||
IF cl_abap_char_utilities=>charsize = 1.
|
||||
RETURN.
|
||||
ENDIF.
|
||||
|
||||
" 0xF8-0xFF are not valid in UTF-8
|
||||
TRY.
|
||||
lv_result = zcl_abapgit_convert=>xstring_to_string_utf8( 'F8FF00' ).
|
||||
|
|
|
@ -85,8 +85,11 @@ CLASS ltcl_xml_output IMPLEMENTATION.
|
|||
|
||||
lv_xstring = lo_conv_out_string->get_buffer( ).
|
||||
|
||||
" Add BOM for Unicode systems
|
||||
IF cl_abap_char_utilities=>charsize > 1.
|
||||
lv_bom = cl_abap_char_utilities=>byte_order_mark_little. "UTF-16LE, 4103
|
||||
CONCATENATE lv_bom lv_xstring INTO lv_xstring IN BYTE MODE.
|
||||
ENDIF.
|
||||
|
||||
lo_conv_in_string = cl_abap_conv_in_ce=>create(
|
||||
encoding = lv_encoding
|
||||
|
|
|
@ -30,7 +30,11 @@ CLASS ltcl_test IMPLEMENTATION.
|
|||
DATA lv_result TYPE string.
|
||||
|
||||
lv_result = mo_cut->print( '<foo></foo>' ).
|
||||
|
||||
" Skip BOM for Unicode systems
|
||||
IF cl_abap_char_utilities=>charsize > 1.
|
||||
lv_result = lv_result+1.
|
||||
ENDIF.
|
||||
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
act = lv_result
|
||||
|
@ -43,7 +47,11 @@ CLASS ltcl_test IMPLEMENTATION.
|
|||
DATA lv_result TYPE string.
|
||||
|
||||
lv_result = mo_cut->print( '<foo>2</foo>' ).
|
||||
|
||||
" Skip BOM for Unicode systems
|
||||
IF cl_abap_char_utilities=>charsize > 1.
|
||||
lv_result = lv_result+1.
|
||||
ENDIF.
|
||||
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
act = lv_result
|
||||
|
@ -56,7 +64,11 @@ CLASS ltcl_test IMPLEMENTATION.
|
|||
DATA lv_result TYPE string.
|
||||
|
||||
lv_result = mo_cut->print( '<foo><bar>2</bar></foo>' ).
|
||||
|
||||
" Skip BOM for Unicode systems
|
||||
IF cl_abap_char_utilities=>charsize > 1.
|
||||
lv_result = lv_result+1.
|
||||
ENDIF.
|
||||
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
act = lv_result
|
||||
|
@ -97,7 +109,10 @@ CLASS ltcl_test IMPLEMENTATION.
|
|||
iv_xml = |<foo>\n <bar>2</bar>\n</foo>|
|
||||
iv_unpretty = abap_true ).
|
||||
|
||||
" Skip BOM for Unicode systems
|
||||
IF cl_abap_char_utilities=>charsize > 1.
|
||||
lv_result = lv_result+1.
|
||||
ENDIF.
|
||||
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
act = lv_result
|
||||
|
|
Loading…
Reference in New Issue
Block a user