Skip to content

Fixed CDATA tagging in JUnit reporter #1085

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fixed CDATA tagging in JUnit reporter
Resolves #1084
  • Loading branch information
jgebal committed Jun 28, 2020
commit cd7d738d23ee25d24596986ba81afaeab66fc1ea
3 changes: 3 additions & 0 deletions source/core/ut_utils.pkb
Original file line number Diff line number Diff line change
Expand Up @@ -827,6 +827,9 @@ create or replace package body ut_utils is
begin
if a_clob is not null and a_clob != empty_clob() then
l_result := replace( a_clob, gc_cdata_end_tag, gc_cdata_end_tag_wrap );
l_result := to_clob(gc_cdata_start_tag)
|| replace( a_clob, gc_cdata_end_tag, gc_cdata_end_tag_wrap )
|| to_clob(gc_cdata_end_tag);
else
l_result := a_clob;
end if;
Expand Down
2 changes: 1 addition & 1 deletion source/reporters/ut_realtime_reporter.tpb
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ create or replace type body ut_realtime_reporter is
) is
begin
if a_content is not null then
self.print_xml_fragment('<' || a_name || '><![CDATA[' || ut_utils.to_cdata(a_content) || ']]></' || a_name || '>');
self.print_xml_fragment('<' || a_name || '>' || ut_utils.to_cdata(a_content) || '</' || a_name || '>');
end if;
end print_cdata_node;

Expand Down
3 changes: 3 additions & 0 deletions test/ut3_user/reporters/test_junit_reporter.pkb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ create or replace package body test_junit_reporter as
begin
ut3_develop.ut.expect(1).to_equal(1);
ut3_develop.ut.expect(1).to_equal(2);
dbms_output.put_line('<xml_tag><![CDATA[ and some raw CDATA <with_xml_tag/> ]]></xml_tag>');
end;

end;]';
Expand Down Expand Up @@ -87,6 +88,8 @@ create or replace package body test_junit_reporter as
--Assert
ut.expect(l_actual).not_to_be_like('%<tag>%');
ut.expect(l_actual).to_be_like('%&lt;tag&gt;%');
ut.expect(l_actual).to_be_like(q'/%<![CDATA[<xml_tag><![CDATA[ and some raw CDATA <with_xml_tag/> ]]]]><![CDATA[></xml_tag>
]]>%/');
end;

procedure reports_only_failed_or_errored is
Expand Down