mirror of
https://github.com/abap2xlsx/abap2xlsx.git
synced 2025-05-05 16:46:11 +08:00
Avoid recent syntax - keep compatible with old SAP
Data declarations made explicit
This commit is contained in:
parent
7e5f6da63d
commit
375334a0ed
|
@ -141,11 +141,19 @@ CLASS ltc_xlsx_date_time DEFINITION FINAL FOR TESTING
|
|||
PRIVATE SECTION.
|
||||
CONSTANTS dt_20230803_140711 TYPE string VALUE `45141.588321759256`. "Excel raw value for date & time 2023-08-03 14:07:11
|
||||
|
||||
DATA cut TYPE REF TO zcl_excel_common.
|
||||
|
||||
METHODS:
|
||||
setup,
|
||||
teardown.
|
||||
|
||||
METHODS:
|
||||
from_xlsx_to_date FOR TESTING RAISING cx_static_check,
|
||||
from_xlsx_to_time FOR TESTING RAISING cx_static_check,
|
||||
from_xlsx_to_timestamp FOR TESTING RAISING cx_static_check.
|
||||
ENDCLASS.
|
||||
|
||||
DATA excel_error TYPE REF TO zcx_excel.
|
||||
ENDCLASS.
|
||||
|
||||
*----------------------------------------------------------------------*
|
||||
* CLASS lcl_Excel_Common_Test IMPLEMENTATION
|
||||
|
@ -1708,16 +1716,24 @@ ENDCLASS.
|
|||
|
||||
CLASS ltc_xlsx_date_time IMPLEMENTATION.
|
||||
|
||||
METHOD setup.
|
||||
cut = NEW #( ).
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD teardown.
|
||||
CLEAR cut.
|
||||
ENDMETHOD.
|
||||
|
||||
METHOD from_xlsx_to_date.
|
||||
TRY.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
act = zcl_excel_common=>excel_string_to_date( dt_20230803_140711 )
|
||||
act = cut->excel_string_to_date( dt_20230803_140711 )
|
||||
exp = '20230803'
|
||||
msg = 'Wrong date from conversion'
|
||||
level = if_aunit_constants=>critical ).
|
||||
CATCH zcx_excel INTO DATA(excel_error).
|
||||
CATCH zcx_excel INTO excel_error.
|
||||
cl_abap_unit_assert=>fail(
|
||||
msg = 'unexpected exception' && excel_error->get_text( )
|
||||
msg = 'Unexpected exception: ' && excel_error->get_text( )
|
||||
level = if_aunit_constants=>critical ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
@ -1725,13 +1741,13 @@ CLASS ltc_xlsx_date_time IMPLEMENTATION.
|
|||
METHOD from_xlsx_to_time.
|
||||
TRY.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
act = zcl_excel_common=>excel_string_to_time( dt_20230803_140711 )
|
||||
act = cut->excel_string_to_time( dt_20230803_140711 )
|
||||
exp = '140711'
|
||||
msg = 'Wrong time from conversion'
|
||||
level = if_aunit_constants=>critical ).
|
||||
CATCH zcx_excel INTO DATA(excel_error).
|
||||
CATCH zcx_excel INTO excel_error.
|
||||
cl_abap_unit_assert=>fail(
|
||||
msg = 'unexpected exception' && excel_error->get_text( )
|
||||
msg = 'Unexpected exception: ' && excel_error->get_text( )
|
||||
level = if_aunit_constants=>critical ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
@ -1739,13 +1755,13 @@ CLASS ltc_xlsx_date_time IMPLEMENTATION.
|
|||
METHOD from_xlsx_to_timestamp.
|
||||
TRY.
|
||||
cl_abap_unit_assert=>assert_equals(
|
||||
act = zcl_excel_common=>excel_string_to_timestamp( dt_20230803_140711 )
|
||||
act = cut->excel_string_to_timestamp( dt_20230803_140711 )
|
||||
exp = '20230803140711'
|
||||
msg = 'Wrong time stamp from conversion'
|
||||
level = if_aunit_constants=>critical ).
|
||||
CATCH zcx_excel INTO DATA(excel_error).
|
||||
CATCH zcx_excel INTO excel_error.
|
||||
cl_abap_unit_assert=>fail(
|
||||
msg = 'unexpected exception' && excel_error->get_text( )
|
||||
msg = 'Unexpected exception: ' && excel_error->get_text( )
|
||||
level = if_aunit_constants=>critical ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
|
|
@ -318,6 +318,8 @@ CLASS ltc_is_date_format DEFINITION FINAL FOR TESTING
|
|||
teardown.
|
||||
METHODS:
|
||||
date_format_iso FOR TESTING RAISING cx_static_check.
|
||||
|
||||
DATA excel_error TYPE REF TO zcx_excel.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
|
@ -334,6 +336,8 @@ CLASS ltc_is_time_format DEFINITION FINAL FOR TESTING
|
|||
teardown.
|
||||
METHODS:
|
||||
time_format_iso FOR TESTING RAISING cx_static_check.
|
||||
|
||||
DATA excel_error TYPE REF TO zcx_excel.
|
||||
ENDCLASS.
|
||||
|
||||
|
||||
|
@ -1708,9 +1712,9 @@ CLASS ltc_is_date_format IMPLEMENTATION.
|
|||
TRY.
|
||||
xlsx = NEW #( ).
|
||||
cut = NEW #( xlsx ).
|
||||
CATCH zcx_excel INTO DATA(excel_error).
|
||||
CATCH zcx_excel INTO excel_error.
|
||||
cl_abap_unit_assert=>fail(
|
||||
msg = 'Could not create instance'
|
||||
msg = 'Could not create instance: ' && excel_error->get_text( )
|
||||
quit = if_aunit_constants=>class ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
@ -1736,9 +1740,9 @@ CLASS ltc_is_time_format IMPLEMENTATION.
|
|||
TRY.
|
||||
xlsx = NEW #( ).
|
||||
cut = NEW #( xlsx ).
|
||||
CATCH zcx_excel INTO DATA(excel_error).
|
||||
CATCH zcx_excel INTO excel_error.
|
||||
cl_abap_unit_assert=>fail(
|
||||
msg = 'Could not create instance'
|
||||
msg = 'Could not create instance: ' && excel_error->get_text( )
|
||||
quit = if_aunit_constants=>class ).
|
||||
ENDTRY.
|
||||
ENDMETHOD.
|
||||
|
|
Loading…
Reference in New Issue
Block a user