From 97d8723b6f16ac4367a4a53b6aa42a96d0babe1d Mon Sep 17 00:00:00 2001 From: Lars Hvam Date: Fri, 10 Dec 2021 19:46:32 +0100 Subject: [PATCH] prioritize_deser, add unit tests (#5193) * prioritize_deser, add unit tests * more tests * change to string * update to latest npm packages, and more unit test --- package.json | 8 +- ...git_file_deserialize.clas.testclasses.abap | 137 +++++++++++++++++- test/abap_transpile.json | 17 +++ 3 files changed, 150 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index 74324a9aa..e3773abd5 100644 --- a/package.json +++ b/package.json @@ -25,11 +25,11 @@ ] }, "devDependencies": { - "@abaplint/cli": "^2.82.10", - "@abaplint/runtime": "^1.6.66", - "@abaplint/transpiler-cli": "^1.6.66", + "@abaplint/cli": "^2.82.15", + "@abaplint/runtime": "^1.6.68", + "@abaplint/transpiler-cli": "^1.6.68", "abapmerge": "^0.14.3", "c8": "^7.10.0", - "eslint": "^8.3.0" + "eslint": "^8.4.1" } } diff --git a/src/objects/core/zcl_abapgit_file_deserialize.clas.testclasses.abap b/src/objects/core/zcl_abapgit_file_deserialize.clas.testclasses.abap index 11b12b45f..e3a966f9a 100644 --- a/src/objects/core/zcl_abapgit_file_deserialize.clas.testclasses.abap +++ b/src/objects/core/zcl_abapgit_file_deserialize.clas.testclasses.abap @@ -221,14 +221,28 @@ CLASS ltcl_prio_deserialization DEFINITION FINAL FOR TESTING METHODS: setup, ddls_before_dcls FOR TESTING RAISING cx_static_check, + webi_before_sprx FOR TESTING RAISING cx_static_check, + iasp_before_isrp FOR TESTING RAISING cx_static_check, + iobj_before_odso FOR TESTING RAISING cx_static_check, + tobj_before_scp1 FOR TESTING RAISING cx_static_check, + otgr_before_char FOR TESTING RAISING cx_static_check, + sprx_before_clas FOR TESTING RAISING cx_static_check, + sprx_before_intf FOR TESTING RAISING cx_static_check, + sprx_before_tabl FOR TESTING RAISING cx_static_check, + pinf_before_devc FOR TESTING RAISING cx_static_check, + clas_before_pinf FOR TESTING RAISING cx_static_check, + enhs_before_ensc FOR TESTING RAISING cx_static_check, + ensc_before_enho FOR TESTING RAISING cx_static_check, + enho_before_enhc FOR TESTING RAISING cx_static_check, + xslt_before_clas_and_prog FOR TESTING RAISING cx_static_check, given IMPORTING - iv_object_type TYPE trobjtype, + iv_object_type TYPE string, when_deser_is_priorized, then IMPORTING - iv_exp_object_type TYPE trobjtype. + iv_exp_object_type TYPE string. DATA: mo_objects TYPE REF TO zcl_abapgit_file_deserialize, @@ -241,29 +255,136 @@ ENDCLASS. CLASS ltcl_prio_deserialization IMPLEMENTATION. METHOD setup. - CREATE OBJECT mo_objects. mv_exp_output_tabix = 0. + ENDMETHOD. + METHOD enhs_before_ensc. + given( 'ENSC' ). + given( 'ENHS' ). + when_deser_is_priorized( ). + then( 'ENHS' ). + then( 'ENSC' ). + ENDMETHOD. + + METHOD ensc_before_enho. + given( 'ENHO' ). + given( 'ENSC' ). + when_deser_is_priorized( ). + then( 'ENSC' ). + then( 'ENHO' ). + ENDMETHOD. + + METHOD enho_before_enhc. + given( 'ENHC' ). + given( 'ENHO' ). + when_deser_is_priorized( ). + then( 'ENHO' ). + then( 'ENHC' ). + ENDMETHOD. + + METHOD sprx_before_clas. + given( 'CLAS' ). + given( 'SPRX' ). + when_deser_is_priorized( ). + then( 'SPRX' ). + then( 'CLAS' ). + ENDMETHOD. + + METHOD sprx_before_intf. + given( 'INTF' ). + given( 'SPRX' ). + when_deser_is_priorized( ). + then( 'SPRX' ). + then( 'INTF' ). + ENDMETHOD. + + METHOD sprx_before_tabl. + given( 'TABL' ). + given( 'SPRX' ). + when_deser_is_priorized( ). + then( 'SPRX' ). + then( 'TABL' ). + ENDMETHOD. + + METHOD otgr_before_char. + given( 'CHAR' ). + given( 'OTGR' ). + when_deser_is_priorized( ). + then( 'OTGR' ). + then( 'CHAR' ). + ENDMETHOD. + + METHOD pinf_before_devc. + given( 'DEVC' ). + given( 'PINF' ). + when_deser_is_priorized( ). + then( 'PINF' ). + then( 'DEVC' ). + ENDMETHOD. + + METHOD tobj_before_scp1. + given( 'SCP1' ). + given( 'TOBJ' ). + when_deser_is_priorized( ). + then( 'TOBJ' ). + then( 'SCP1' ). + ENDMETHOD. + + METHOD iobj_before_odso. + given( 'ODSO' ). + given( 'IOBJ' ). + when_deser_is_priorized( ). + then( 'IOBJ' ). + then( 'ODSO' ). + ENDMETHOD. + + METHOD iasp_before_isrp. + given( 'ISRP' ). + given( 'IASP' ). + when_deser_is_priorized( ). + then( 'IASP' ). + then( 'ISRP' ). + ENDMETHOD. + + METHOD webi_before_sprx. + given( 'SPRX' ). + given( 'WEBI' ). + when_deser_is_priorized( ). + then( 'WEBI' ). + then( 'SPRX' ). + ENDMETHOD. + + METHOD clas_before_pinf. + given( 'PINF' ). + given( 'CLAS' ). + when_deser_is_priorized( ). + then( 'CLAS' ). + then( 'PINF' ). + ENDMETHOD. + + METHOD xslt_before_clas_and_prog. + given( 'XSLT' ). + given( 'INTF' ). + given( 'CLAS' ). + when_deser_is_priorized( ). + then( 'XSLT' ). + then( 'INTF' ). + then( 'CLAS' ). ENDMETHOD. METHOD ddls_before_dcls. - given( 'DCLS' ). given( 'DDLS' ). given( 'DCLS' ). given( 'DDLS' ). - when_deser_is_priorized( ). - then( 'DDLS' ). then( 'DDLS' ). then( 'DCLS' ). then( 'DCLS' ). - ENDMETHOD. - METHOD given. DATA: ls_input LIKE LINE OF mt_input. diff --git a/test/abap_transpile.json b/test/abap_transpile.json index 385164cb9..6f8a6e81a 100644 --- a/test/abap_transpile.json +++ b/test/abap_transpile.json @@ -18,6 +18,7 @@ "zcl_abapgit_gui*", "zcl_abapgit_hash", "zcl_abapgit_html*", + "zcl_abapgit_file_deserialize", "zcl_abapgit_http*", "zcl_abapgit_injector", "zcl_abapgit_log.clas", @@ -229,6 +230,22 @@ {"object": "ZCL_ABAPGIT_HTML_FORM_UTILS", "class": "ltcl_test_form", "method": "exit_dirty_confirm", "note": "Void type: TIMESTAMPL"}, {"object": "ZCL_ABAPGIT_HTML_FORM_UTILS", "class": "ltcl_test_form", "method": "exit_dirty_cancel", "note": "Void type: TIMESTAMPL"}, + {"object": "ZCL_ABAPGIT_FILE_DESERIALIZE", "class": "ltcl_prio_deserialization", "method": "ddls_before_dcls", "note": "hmm, something with promises?"}, + {"object": "ZCL_ABAPGIT_FILE_DESERIALIZE", "class": "ltcl_prio_deserialization", "method": "webi_before_sprx", "note": "hmm, something with promises?"}, + {"object": "ZCL_ABAPGIT_FILE_DESERIALIZE", "class": "ltcl_prio_deserialization", "method": "iasp_before_isrp", "note": "hmm, something with promises?"}, + {"object": "ZCL_ABAPGIT_FILE_DESERIALIZE", "class": "ltcl_prio_deserialization", "method": "iobj_before_odso", "note": "hmm, something with promises?"}, + {"object": "ZCL_ABAPGIT_FILE_DESERIALIZE", "class": "ltcl_prio_deserialization", "method": "tobj_before_scp1", "note": "hmm, something with promises?"}, + {"object": "ZCL_ABAPGIT_FILE_DESERIALIZE", "class": "ltcl_prio_deserialization", "method": "otgr_before_char", "note": "hmm, something with promises?"}, + {"object": "ZCL_ABAPGIT_FILE_DESERIALIZE", "class": "ltcl_prio_deserialization", "method": "sprx_before_clas", "note": "hmm, something with promises?"}, + {"object": "ZCL_ABAPGIT_FILE_DESERIALIZE", "class": "ltcl_prio_deserialization", "method": "sprx_before_intf", "note": "hmm, something with promises?"}, + {"object": "ZCL_ABAPGIT_FILE_DESERIALIZE", "class": "ltcl_prio_deserialization", "method": "sprx_before_tabl", "note": "hmm, something with promises?"}, + {"object": "ZCL_ABAPGIT_FILE_DESERIALIZE", "class": "ltcl_prio_deserialization", "method": "pinf_before_devc", "note": "hmm, something with promises?"}, + {"object": "ZCL_ABAPGIT_FILE_DESERIALIZE", "class": "ltcl_prio_deserialization", "method": "clas_before_pinf", "note": "hmm, something with promises?"}, + {"object": "ZCL_ABAPGIT_FILE_DESERIALIZE", "class": "ltcl_prio_deserialization", "method": "enhs_before_ensc", "note": "hmm, something with promises?"}, + {"object": "ZCL_ABAPGIT_FILE_DESERIALIZE", "class": "ltcl_prio_deserialization", "method": "ensc_before_enho", "note": "hmm, something with promises?"}, + {"object": "ZCL_ABAPGIT_FILE_DESERIALIZE", "class": "ltcl_prio_deserialization", "method": "enho_before_enhc", "note": "hmm, something with promises?"}, + {"object": "ZCL_ABAPGIT_FILE_DESERIALIZE", "class": "ltcl_prio_deserialization", "method": "xslt_before_clas_and_prog", "note": "hmm, something with promises?"}, + {"object": "ZCL_ABAPGIT_DOT_ABAPGIT", "class": "ltcl_dot_abapgit", "method": "ignore", "note": "Void type: DLVUNIT"}, {"object": "ZCL_ABAPGIT_DOT_ABAPGIT", "class": "ltcl_dot_abapgit", "method": "identity"} ]