mirror of
https://github.com/abapGit/abapGit.git
synced 2025-04-30 20:03:20 +08:00
dont serialize empty testclass includes, close #136
This commit is contained in:
parent
433c0e4409
commit
4602ede65a
|
@ -3,7 +3,7 @@ REPORT zabapgit.
|
|||
* See https://github.com/larshp/abapGit/
|
||||
|
||||
CONSTANTS: gc_xml_version TYPE string VALUE 'v0.2-alpha', "#EC NOTEXT
|
||||
gc_abap_version TYPE string VALUE 'v0.87'. "#EC NOTEXT
|
||||
gc_abap_version TYPE string VALUE 'v0.88'. "#EC NOTEXT
|
||||
|
||||
********************************************************************************
|
||||
* The MIT License (MIT)
|
||||
|
@ -3295,6 +3295,8 @@ CLASS lcl_object_clas DEFINITION INHERITING FROM lcl_objects_common FINAL.
|
|||
RAISING lcx_exception.
|
||||
|
||||
PRIVATE SECTION.
|
||||
CLASS-DATA: gv_skip_testclass TYPE abap_bool.
|
||||
|
||||
CLASS-METHODS deserialize_abap
|
||||
IMPORTING is_item TYPE ty_item
|
||||
it_files TYPE ty_files_tt
|
||||
|
@ -3475,6 +3477,10 @@ CLASS lcl_object_clas IMPLEMENTATION.
|
|||
|
||||
METHOD serialize_testclasses.
|
||||
|
||||
DATA: lv_line1 LIKE LINE OF rt_source,
|
||||
lv_line2 LIKE LINE OF rt_source.
|
||||
|
||||
|
||||
CALL FUNCTION 'SEO_CLASS_GET_INCLUDE_SOURCE'
|
||||
EXPORTING
|
||||
clskey = is_clskey
|
||||
|
@ -3489,6 +3495,27 @@ CLASS lcl_object_clas IMPLEMENTATION.
|
|||
_raise 'Error from get_include_source, test'.
|
||||
ENDIF.
|
||||
|
||||
* when creating classes in Eclipse it automatically generates the
|
||||
* testclass include, but it is not needed, so skip to avoid
|
||||
* creating an extra file in the repository.
|
||||
* Also remove it if the content is manually removed, but
|
||||
* the class still thinks it contains tests
|
||||
gv_skip_testclass = abap_false.
|
||||
IF lines( rt_source ) = 2.
|
||||
READ TABLE rt_source INDEX 1 INTO lv_line1.
|
||||
READ TABLE rt_source INDEX 2 INTO lv_line2.
|
||||
IF lv_line1(3) = '*"*' AND lv_line2 IS INITIAL.
|
||||
gv_skip_testclass = abap_true.
|
||||
ENDIF.
|
||||
ELSEIF lines( rt_source ) = 1.
|
||||
READ TABLE rt_source INDEX 1 INTO lv_line1.
|
||||
IF lv_line1(3) = '*"*' OR lv_line1 IS INITIAL.
|
||||
gv_skip_testclass = abap_true.
|
||||
ENDIF.
|
||||
ELSEIF lines( rt_source ) = 0.
|
||||
gv_skip_testclass = abap_true.
|
||||
ENDIF.
|
||||
|
||||
ENDMETHOD. "serialize_test
|
||||
|
||||
METHOD serialize_macros.
|
||||
|
@ -3632,7 +3659,7 @@ CLASS lcl_object_clas IMPLEMENTATION.
|
|||
ENDIF.
|
||||
|
||||
lt_source = serialize_testclasses( ls_clskey ).
|
||||
IF NOT lt_source[] IS INITIAL.
|
||||
IF NOT lt_source[] IS INITIAL AND gv_skip_testclass = abap_false.
|
||||
ls_file = abap_to_file( is_item = is_item
|
||||
iv_extra = 'testclasses'
|
||||
it_abap = lt_source ). "#EC NOTEXT
|
||||
|
@ -3698,6 +3725,10 @@ CLASS lcl_object_clas IMPLEMENTATION.
|
|||
ls_vseoclass-chgdanyby,
|
||||
ls_vseoclass-chgdanyon.
|
||||
|
||||
IF gv_skip_testclass = abap_true.
|
||||
CLEAR ls_vseoclass-with_unit_tests.
|
||||
ENDIF.
|
||||
|
||||
CLEAR: ls_vseointerf-uuid,
|
||||
ls_vseointerf-author,
|
||||
ls_vseointerf-createdon,
|
||||
|
|
Loading…
Reference in New Issue
Block a user