Skip to content

Commit 16521a2

Browse files
committed
add testcase
1 parent 81ff1ea commit 16521a2

File tree

2 files changed

+25
-3
lines changed

2 files changed

+25
-3
lines changed

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
},
1616
"license": "MIT",
1717
"dependencies": {
18-
"@abaplint/cli": "^2.113.233",
18+
"@abaplint/cli": "^2.113.234",
1919
"@abaplint/database-pg": "^2.11.78",
2020
"@abaplint/database-sqlite": "^2.11.78",
21-
"@abaplint/runtime": "^2.12.7",
22-
"@abaplint/transpiler-cli": "^2.12.7",
21+
"@abaplint/runtime": "^2.12.8",
22+
"@abaplint/transpiler-cli": "^2.12.8",
2323
"0x": "^6.0.0"
2424
}
2525
}

src/abap/regex/cl_abap_regex.clas.testclasses.abap

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ CLASS ltcl_test DEFINITION FOR TESTING DURATION SHORT RISK LEVEL HARMLESS FINAL.
1111
METHODS replace_oo FOR TESTING RAISING cx_static_check.
1212
METHODS pcre_slashes FOR TESTING RAISING cx_static_check.
1313
METHODS classic_slashes FOR TESTING RAISING cx_static_check.
14+
METHODS digits FOR TESTING RAISING cx_static_check.
1415

1516
ENDCLASS.
1617

@@ -218,4 +219,25 @@ CLASS ltcl_test IMPLEMENTATION.
218219

219220
ENDMETHOD.
220221

222+
METHOD digits.
223+
224+
DATA l_offset TYPE i.
225+
DATA l_counter TYPE string.
226+
DATA name TYPE string.
227+
DATA lo_regex TYPE REF TO cl_abap_regex.
228+
229+
name = 'notFound'.
230+
CREATE OBJECT lo_regex EXPORTING pattern = '([[:digit:]]*)$'.
231+
FIND FIRST OCCURRENCE OF REGEX lo_regex IN name SUBMATCHES l_counter MATCH OFFSET l_offset.
232+
233+
cl_abap_unit_assert=>assert_equals(
234+
act = l_counter
235+
exp = '' ).
236+
237+
cl_abap_unit_assert=>assert_equals(
238+
act = l_offset
239+
exp = 8 ).
240+
241+
ENDMETHOD.
242+
221243
ENDCLASS.

0 commit comments

Comments
 (0)