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

Skip to content

Commit 7b5e02e

Browse files
committed
Fixed indexing of warnings for documentation reporter
1 parent 65d0169 commit 7b5e02e

3 files changed

Lines changed: 61 additions & 1 deletion

File tree

source/reporters/ut_documentation_reporter.tpb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ create or replace type body ut_documentation_reporter is
8585

8686
overriding member procedure after_calling_run(self in out nocopy ut_documentation_reporter, a_run in ut_run) as
8787
l_summary_text varchar2(4000);
88+
l_warning_index pls_integer := 0;
89+
8890
procedure print_failure_for_expectation(a_expectation ut_expectation_result) is
8991
l_lines ut_varchar2_list;
9092
begin
@@ -151,7 +153,8 @@ create or replace type body ut_documentation_reporter is
151153

152154
if a_item.warnings is not null and a_item.warnings.count > 0 then
153155
for i in 1 .. a_item.warnings.count loop
154-
self.print_text(' ' || i || ') ' || a_item.path);
156+
l_warning_index := l_warning_index + 1;
157+
self.print_text(' ' || l_warning_index || ') ' || a_item.path);
155158
self.lvl := self.lvl + 3;
156159
self.print_red_text(a_item.warnings(i));
157160
self.lvl := self.lvl - 3;

tests/RunAll.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ exec ut_coverage.coverage_start_develop();
134134
@@lib/RunTest.sql ut_reporters/ut_xunit_reporter.ProducesExpectedOutputs.sql
135135
@@lib/RunTest.sql ut_reporters/ut_html_reporter.UserOverrideSchemaCoverage.sql
136136
@@lib/RunTest.sql ut_reporters/ut_html_reporter.DefaultSchemaCoverage.sql
137+
@@lib/RunTest.sql ut_reporters/ut_documentation_reporter.reportMultipleWarnings.sql
137138

138139
@@lib/RunTest.sql ut/ut.run.AcceptsCoverageFileList.sql
139140
@@lib/RunTest.sql ut/ut.run.AcceptsCoverageFileListWithSutePaths.sql
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
set termout off
2+
create or replace package tst_documrep_mult_warn as
3+
--%suite
4+
5+
--%test
6+
procedure test1;
7+
end;
8+
/
9+
10+
create or replace package body tst_documrep_mult_warn as
11+
procedure test1 is begin commit; end;
12+
end;
13+
/
14+
create or replace package tst_documrep_mult_warn2 as
15+
--%suite
16+
17+
--%test
18+
procedure test1;
19+
end;
20+
/
21+
22+
create or replace package body tst_documrep_mult_warn2 as
23+
procedure test1 is begin commit; end;
24+
end;
25+
/
26+
27+
set termout on
28+
29+
declare
30+
l_test_report ut_varchar2_list;
31+
l_output_data ut_varchar2_list;
32+
l_output varchar2(32767);
33+
l_expected varchar2(32767);
34+
begin
35+
l_expected := q'[%Warnings:
36+
%1)%tst_documrep_mult_warn%
37+
%2)%tst_documrep_mult_warn%]';
38+
39+
--act
40+
select *
41+
bulk collect into l_output_data
42+
from table(ut.run(ut_varchar2_list('tst_documrep_mult_warn','tst_documrep_mult_warn2'),ut_xunit_reporter()));
43+
44+
l_output := ut_utils.table_to_clob(l_output_data);
45+
46+
--assert
47+
if l_output like l_expected then
48+
:test_result := ut_utils.tr_success;
49+
else
50+
dbms_output.put_line('Actual:"'||l_output||'"');
51+
end if;
52+
end;
53+
/
54+
55+
drop package tst_documrep_mult_warn;
56+
drop package tst_documrep_mult_warn2;

0 commit comments

Comments
 (0)