Skip to content

Commit b99151c

Browse files
authored
implement escape_quotes + escape_quotes_str (#1019)
1 parent e1de9c9 commit b99151c

File tree

2 files changed

+28
-2
lines changed

2 files changed

+28
-2
lines changed

src/abap/dyn/cl_abap_dyn_prg.clas.abap

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ CLASS cl_abap_dyn_prg IMPLEMENTATION.
7777
ENDMETHOD.
7878

7979
METHOD escape_quotes_str.
80-
ASSERT 1 = 'todo'.
80+
out = val.
81+
REPLACE ALL OCCURRENCES OF '`' IN out WITH '``'.
8182
ENDMETHOD.
8283

8384
METHOD check_table_or_view_name_str.
@@ -103,7 +104,8 @@ CLASS cl_abap_dyn_prg IMPLEMENTATION.
103104
ENDMETHOD.
104105

105106
METHOD escape_quotes.
106-
ASSERT 1 = 'todo'.
107+
out = val.
108+
REPLACE ALL OCCURRENCES OF `'` IN out WITH `''`.
107109
ENDMETHOD.
108110

109111
METHOD escape_xss_xml_html.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
CLASS ltcl_dyn_prg DEFINITION FOR TESTING RISK LEVEL HARMLESS DURATION SHORT FINAL.
2+
3+
PRIVATE SECTION.
4+
METHODS escape_quotes1 FOR TESTING RAISING cx_static_check.
5+
METHODS escape_quotes_str1 FOR TESTING RAISING cx_static_check.
6+
7+
ENDCLASS.
8+
9+
CLASS ltcl_dyn_prg IMPLEMENTATION.
10+
METHOD escape_quotes_str1.
11+
cl_abap_unit_assert=>assert_equals(
12+
act = cl_abap_dyn_prg=>escape_quotes_str( 'hello ` world' )
13+
exp = 'hello `` world' ).
14+
ENDMETHOD.
15+
16+
METHOD escape_quotes1.
17+
18+
cl_abap_unit_assert=>assert_equals(
19+
act = cl_abap_dyn_prg=>escape_quotes( `hello ' world` )
20+
exp = `hello '' world` ).
21+
22+
ENDMETHOD.
23+
24+
ENDCLASS.

0 commit comments

Comments
 (0)