Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 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
8 changes: 7 additions & 1 deletion source/reporters/ut_documentation_reporter.tpb
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ create or replace type body ut_documentation_reporter is

overriding member procedure after_calling_run(self in out nocopy ut_documentation_reporter, a_run in ut_run) as
l_summary_text varchar2(4000);
l_warning_index pls_integer := 0;
-- make all warning indexes uniformly indented
c_warnings_lpad constant integer := length(to_char(a_run.results_count.warnings_count));

procedure print_failure_for_expectation(a_expectation ut_expectation_result) is
l_lines ut_varchar2_list;
begin
Expand Down Expand Up @@ -151,7 +155,8 @@ create or replace type body ut_documentation_reporter is

if a_item.warnings is not null and a_item.warnings.count > 0 then
for i in 1 .. a_item.warnings.count loop
self.print_text(' ' || i || ') ' || a_item.path);
l_warning_index := l_warning_index + 1;
self.print_text(' ' || lpad(l_warning_index, c_warnings_lpad) || ') ' || a_item.path);
self.lvl := self.lvl + 3;
self.print_red_text(a_item.warnings(i));
self.lvl := self.lvl - 3;
Expand All @@ -177,6 +182,7 @@ create or replace type body ut_documentation_reporter is
print_failures_details(a_run);
print_warnings(a_run);
self.print_text('Finished in ' || a_run.execution_time || ' seconds');

l_summary_text :=
a_run.results_count.total_count || ' tests, '
|| a_run.results_count.failure_count || ' failed, ' || a_run.results_count.errored_count || ' errored, '
Expand Down
1 change: 1 addition & 0 deletions tests/RunAll.sql
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ exec ut_coverage.coverage_start_develop();
@@lib/RunTest.sql ut_reporters/ut_xunit_reporter.ProducesExpectedOutputs.sql
@@lib/RunTest.sql ut_reporters/ut_html_reporter.UserOverrideSchemaCoverage.sql
@@lib/RunTest.sql ut_reporters/ut_html_reporter.DefaultSchemaCoverage.sql
@@lib/RunTest.sql ut_reporters/ut_documentation_reporter.reportMultipleWarnings.sql
@@lib/RunTest.sql ut_reporters/ut_xunit_reporter.ReportOnSuiteWithoutDesc.sql
@@lib/RunTest.sql ut_reporters/ut_xunit_reporter.ReportOnTestWithoutDesc.sql

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
set termout off
create or replace package tst_documrep_mult_warn as
--%suite

--%test
procedure test1;
end;
/

create or replace package body tst_documrep_mult_warn as
procedure test1 is begin commit; end;
end;
/
create or replace package tst_documrep_mult_warn2 as
--%suite

--%test
procedure test1;
end;
/

create or replace package body tst_documrep_mult_warn2 as
procedure test1 is begin commit; end;
end;
/

set termout on

declare
l_test_report ut_varchar2_list;
l_output_data ut_varchar2_list;
l_output varchar2(32767);
l_expected varchar2(32767);
begin
l_expected := q'[%Warnings:
%1)%tst_documrep_mult_warn%
%2)%tst_documrep_mult_warn%]';

--act
select *
bulk collect into l_output_data
from table(ut.run(ut_varchar2_list('tst_documrep_mult_warn','tst_documrep_mult_warn2'),ut_documentation_reporter()));

l_output := ut_utils.table_to_clob(l_output_data);

--assert
if l_output like l_expected then
:test_result := ut_utils.tr_success;
else
dbms_output.put_line('Actual:"'||l_output||'"');
end if;
end;
/

drop package tst_documrep_mult_warn;
drop package tst_documrep_mult_warn2;