@@ -101,6 +101,8 @@ class ltcl_text2tab_parser_test definition for testing
101101 methods deep_structures for testing .
102102 methods parse_corresponding for testing raising zcx_text2tab_error.
103103
104+ methods begin_comments for testing raising zcx_text2tab_error.
105+ methods line_comments for testing raising zcx_text2tab_error.
104106
105107* ==== HELPERS ===
106108
@@ -1655,4 +1657,69 @@ class ltcl_text2tab_parser_test implementation.
16551657
16561658 endmethod .
16571659
1660+ method begin_comments .
1661+
1662+ data lv_text_orig type string .
1663+ data lt_exp type tt_dummy.
1664+ data lt_act like lt_exp.
1665+
1666+ get_dummy_data(
1667+ importing
1668+ e_dummy_tab = lt_exp
1669+ e_dummy_string = lv_text_orig ).
1670+
1671+ zcl_text2tab_parser=>create(
1672+ i_pattern = lt_act
1673+ i_begin_comment = '#'
1674+ )->parse(
1675+ exporting
1676+ i_data = | #comment{ c_crlf }{ lv_text_orig } |
1677+ importing
1678+ e_container = lt_act ).
1679+
1680+ cl_abap_unit_assert=>assert_equals(
1681+ act = lt_act
1682+ exp = lt_exp ).
1683+
1684+ zcl_text2tab_parser=>create(
1685+ i_pattern = lt_act
1686+ i_begin_comment = zif_text2tab=>c_auto_detect_by_space
1687+ )->parse(
1688+ exporting
1689+ i_data = | field descr with space\tanother one...{ c_crlf }{ lv_text_orig } |
1690+ importing
1691+ e_container = lt_act ).
1692+
1693+ cl_abap_unit_assert=>assert_equals(
1694+ act = lt_act
1695+ exp = lt_exp ).
1696+
1697+ endmethod .
1698+
1699+ method line_comments .
1700+
1701+ data lv_text_orig type string .
1702+ data lt_exp type tt_dummy.
1703+ data lt_act like lt_exp.
1704+
1705+ get_dummy_data(
1706+ importing
1707+ e_dummy_tab = lt_exp
1708+ e_dummy_string = lv_text_orig ).
1709+
1710+ zcl_text2tab_parser=>create(
1711+ i_pattern = lt_act
1712+ i_skip_lines_starting_with = '#'
1713+ )->parse(
1714+ exporting
1715+ i_data = | { lv_text_orig } #comment| " CRLF is already at the end, no need to add
1716+ importing
1717+ e_container = lt_act ).
1718+
1719+ cl_abap_unit_assert=>assert_equals(
1720+ act = lt_act
1721+ exp = lt_exp ).
1722+
1723+ endmethod .
1724+
16581725endclass .
0 commit comments