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

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Fixed indexing of warnings for documentation reporter
  • Loading branch information
Pazus committed Jun 27, 2017
commit 7b5e02e23abd74b371d65a2c78e45d011c0025ad
5 changes: 4 additions & 1 deletion source/reporters/ut_documentation_reporter.tpb
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ 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;

procedure print_failure_for_expectation(a_expectation ut_expectation_result) is
l_lines ut_varchar2_list;
begin
Expand Down Expand Up @@ -151,7 +153,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(' ' || l_warning_index || ') ' || a_item.path);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you make both error_no and warning_no uniformly indented

lpad(l_warning_index,5)

I don't expect any report to have more than 9999 errors or warnings in it.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. It is already done for errors, so I made it only for warnings

self.lvl := self.lvl + 3;
self.print_red_text(a_item.warnings(i));
self.lvl := self.lvl - 3;
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/ut.run.AcceptsCoverageFileList.sql
@@lib/RunTest.sql ut/ut.run.AcceptsCoverageFileListWithSutePaths.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_xunit_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;