Skip to content

Commit 33865dd

Browse files
committed
Added escaped comment test
1 parent f1c0f86 commit 33865dd

3 files changed

Lines changed: 26 additions & 1 deletion

File tree

source/reporters/ut_tap_reporter.tpb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ create or replace type body ut_tap_reporter is
1010

1111
member procedure print_comment(self in out nocopy ut_tap_reporter, a_comment clob) as
1212
begin
13-
self.print_clob(regexp_replace(a_comment, '^', '# ', 1, 0, 'm'));
13+
self.print_clob(regexp_replace(self.escape_special_chars(a_comment), '^', '# ', 1, 0, 'm'));
1414
end print_comment;
1515

1616
member function escape_special_chars(self in out nocopy ut_tap_reporter, a_string_to_escape clob) return clob as

test/ut3_user/reporters/test_tap_reporter.pkb

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ create or replace package body test_tap_reporter as
1717
--%test(Disabled test)
1818
--%disabled(With \ and # in skip reason)
1919
procedure not_skipping_escapes;
20+
21+
--%test(Escaped Comments)
22+
procedure escaped_comments;
2023
end test_tap_escaping;
2124
]';
2225

@@ -34,6 +37,11 @@ create or replace package body test_tap_reporter as
3437
ut.expect(10).to_equal(1);
3538
end not_skipping_escapes;
3639

40+
procedure escaped_comments as
41+
begin
42+
dbms_output.put_line('This \ and # should be escaped, but this not!!!');
43+
ut.expect(1).to_equal(1);
44+
end escaped_comments;
3745
end test_tap_escaping;
3846
]';
3947

@@ -165,6 +173,20 @@ create or replace package body test_tap_reporter as
165173
end special_characters_in_deisabled_reason;
166174

167175

176+
procedure special_characters_in_comment as
177+
l_output_data ut3_develop.ut_varchar2_list;
178+
l_expected varchar2(32767);
179+
begin
180+
l_expected := q'[%ok - Escaped Comments%# This \\ and \# should be escaped, but this not!!!%]';
181+
182+
select *
183+
bulk collect into l_output_data
184+
from table(ut3_develop.ut.run('test_tap_escaping.escaped_comments',ut3_develop.ut_tap_reporter()));
185+
186+
ut.expect(ut3_tester_helper.main_helper.table_to_clob(l_output_data)).to_be_like(l_expected);
187+
end special_characters_in_comment;
188+
189+
168190
procedure drop_help_tests as
169191
pragma autonomous_transaction;
170192
begin

test/ut3_user/reporters/test_tap_reporter.pks

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ create or replace package test_tap_reporter as
3333
--%test(Disabled Test with special characters in disable reason)
3434
procedure special_characters_in_deisabled_reason;
3535

36+
--%test(Escape special characters in comment)
37+
procedure special_characters_in_comment;
38+
3639

3740
--%afterall
3841
procedure drop_help_tests;

0 commit comments

Comments
 (0)