mirror of
https://github.com/abapGit/abapGit.git
synced 2025-05-03 13:26:12 +08:00

* Patch: replace links with checkboxes With this commit we replace the links on the patch page with checkboxes. This has several advantages: - better performance - simplified and less cluttered UI - less and easier to understand code * refactor * refactoring: introduce new method add_checkbox * fix linter * enable link hint navigation * Refactoring: remove duplication * refactor: remove duplication * fix: link hint activate section/lines
114 lines
2.9 KiB
ABAP
114 lines
2.9 KiB
ABAP
*"* use this source file for your ABAP unit test classes
|
|
|
|
CLASS ltcl_patch DEFINITION FINAL FOR TESTING
|
|
DURATION SHORT
|
|
RISK LEVEL HARMLESS.
|
|
|
|
PRIVATE SECTION.
|
|
METHODS:
|
|
get_patch_data_add FOR TESTING RAISING cx_static_check,
|
|
get_patch_data_remove FOR TESTING RAISING cx_static_check,
|
|
invalid_patch_missing_file FOR TESTING RAISING cx_static_check,
|
|
invalid_patch_missing_index FOR TESTING RAISING cx_static_check.
|
|
|
|
ENDCLASS.
|
|
|
|
CLASS zcl_abapgit_gui_page_diff DEFINITION LOCAL FRIENDS ltcl_patch.
|
|
|
|
CLASS ltcl_patch IMPLEMENTATION.
|
|
|
|
METHOD get_patch_data_add.
|
|
|
|
DATA: lv_file_name TYPE string,
|
|
lv_line_index TYPE string.
|
|
|
|
zcl_abapgit_gui_page_diff=>get_patch_data(
|
|
EXPORTING
|
|
iv_patch = |patch_line_zcl_test_git_add_p.clas.abap_0_19|
|
|
IMPORTING
|
|
ev_filename = lv_file_name
|
|
ev_line_index = lv_line_index ).
|
|
|
|
cl_abap_unit_assert=>assert_equals(
|
|
exp = |zcl_test_git_add_p.clas.abap|
|
|
act = lv_file_name ).
|
|
|
|
cl_abap_unit_assert=>assert_equals(
|
|
exp = |19|
|
|
act = lv_line_index ).
|
|
|
|
ENDMETHOD.
|
|
|
|
METHOD get_patch_data_remove.
|
|
|
|
DATA: lv_file_name TYPE string,
|
|
lv_line_index TYPE string.
|
|
|
|
zcl_abapgit_gui_page_diff=>get_patch_data(
|
|
EXPORTING
|
|
iv_patch = |patch_line_ztest_patch.prog.abap_0_39|
|
|
IMPORTING
|
|
ev_filename = lv_file_name
|
|
ev_line_index = lv_line_index ).
|
|
|
|
cl_abap_unit_assert=>assert_equals(
|
|
exp = |ztest_patch.prog.abap|
|
|
act = lv_file_name ).
|
|
|
|
cl_abap_unit_assert=>assert_equals(
|
|
exp = |39|
|
|
act = lv_line_index ).
|
|
|
|
ENDMETHOD.
|
|
|
|
|
|
METHOD invalid_patch_missing_file.
|
|
|
|
DATA: lv_file_name TYPE string,
|
|
lv_line_index TYPE string,
|
|
lx_error TYPE REF TO zcx_abapgit_exception.
|
|
|
|
TRY.
|
|
zcl_abapgit_gui_page_diff=>get_patch_data(
|
|
EXPORTING
|
|
iv_patch = |patch_39|
|
|
IMPORTING
|
|
ev_filename = lv_file_name
|
|
ev_line_index = lv_line_index ).
|
|
|
|
cl_abap_unit_assert=>fail( ).
|
|
|
|
CATCH zcx_abapgit_exception INTO lx_error.
|
|
cl_abap_unit_assert=>assert_equals(
|
|
exp = |Invalid patch|
|
|
act = lx_error->get_text( ) ).
|
|
ENDTRY.
|
|
|
|
ENDMETHOD.
|
|
|
|
METHOD invalid_patch_missing_index.
|
|
|
|
DATA: lv_file_name TYPE string,
|
|
lv_line_index TYPE string,
|
|
lx_error TYPE REF TO zcx_abapgit_exception.
|
|
|
|
TRY.
|
|
zcl_abapgit_gui_page_diff=>get_patch_data(
|
|
EXPORTING
|
|
iv_patch = |patch_ztest_patch.prog.abap|
|
|
IMPORTING
|
|
ev_filename = lv_file_name
|
|
ev_line_index = lv_line_index ).
|
|
|
|
cl_abap_unit_assert=>fail( ).
|
|
|
|
CATCH zcx_abapgit_exception INTO lx_error.
|
|
cl_abap_unit_assert=>assert_equals(
|
|
exp = |Invalid patch|
|
|
act = lx_error->get_text( ) ).
|
|
ENDTRY.
|
|
|
|
ENDMETHOD.
|
|
|
|
ENDCLASS.
|