add basic unit test for recursive_struct_to_class (#1124)

* add basic unit test for recursive_struct_to_class

* Update zcl_excel_common.clas.testclasses.abap
This commit is contained in:
Lars Hvam 2024-01-29 07:21:05 +01:00 committed by GitHub
parent b4a79ebe6c
commit 1148838a0f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -125,12 +125,14 @@ CLASS lcl_excel_common_test DEFINITION FOR TESTING
METHODS is_cell_in_range_upperside_out FOR TESTING.
METHODS is_cell_in_range_rightside_out FOR TESTING.
METHODS is_cell_in_range_lowerside_out FOR TESTING.
METHODS recursive_struct_to_class FOR TESTING RAISING cx_static_check.
METHODS escape_string_whitespace1 FOR TESTING.
METHODS escape_string_whitespace2 FOR TESTING.
METHODS escape_string_whitespace3 FOR TESTING.
METHODS escape_string_quote FOR TESTING.
METHODS escape_string_hyphen FOR TESTING.
METHODS escape_string_regular FOR TESTING.
ENDCLASS.
@ -1647,6 +1649,29 @@ CLASS lcl_excel_common_test IMPLEMENTATION.
ENDTRY.
ENDMETHOD. "is_cell_in_range_lowerside_out.
METHOD recursive_struct_to_class.
DATA style TYPE REF TO zcl_excel_style.
DATA complete_style TYPE zexcel_s_cstyle_complete.
DATA complete_stylex TYPE zexcel_s_cstylex_complete.
CREATE OBJECT style.
complete_style-number_format-format_code = 'hello'.
complete_stylex-number_format-format_code = abap_true.
zcl_excel_common=>recursive_struct_to_class(
EXPORTING
i_source = complete_style
i_sourcex = complete_stylex
CHANGING
e_target = style ).
cl_abap_unit_assert=>assert_equals(
act = style->number_format->format_code
exp = 'hello' ).
ENDMETHOD.
METHOD escape_string_hyphen.
DATA: name TYPE string,
escaped_name TYPE string.