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

Skip to content

Commit b8cd878

Browse files
committed
Updated tests.
1 parent a6de86f commit b8cd878

2 files changed

Lines changed: 56 additions & 24 deletions

File tree

Lines changed: 42 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,30 @@
11
set termout off
2-
create or replace package tst_documrep_mult_warn as
2+
create or replace package ut_output_test_rollback as
33
--%suite
44

5+
--%beforeall
6+
procedure ba;
7+
--%beforeeach
8+
procedure be;
59
--%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-
10+
procedure test;
1711
--%test
18-
procedure test1;
12+
--%rollback(manual)
13+
procedure t_manual;
14+
--%afterall
15+
procedure aa;
16+
--%aftereach
17+
procedure ae;
1918
end;
2019
/
2120

22-
create or replace package body tst_documrep_mult_warn2 as
23-
procedure test1 is begin commit; end;
21+
create or replace package body ut_output_test_rollback as
22+
procedure ba is begin commit; end;
23+
procedure be is begin commit; end;
24+
procedure test is begin null; end;
25+
procedure t_manual is begin commit; end;
26+
procedure aa is begin commit; end;
27+
procedure ae is begin commit; end;
2428
end;
2529
/
2630

@@ -32,14 +36,31 @@ declare
3236
l_output varchar2(32767);
3337
l_expected varchar2(32767);
3438
begin
35-
l_expected := q'[%Warnings:
36-
%1)%tst_documrep_mult_warn%
37-
%2)%tst_documrep_mult_warn%]';
39+
l_expected := q'[%
40+
1) ut_output_test_rollback.test
41+
Unable to perform automatic rollback after test. An implicit or explicit commit/rollback occurred in procedures:
42+
ut3.ut_output_test_rollback.be
43+
ut3.ut_output_test_rollback.ae
44+
Use the "--%rollback(manual)" annotation or remove commit/rollback/ddl statements that are causing the issue.
45+
%
46+
2) ut_output_test_rollback
47+
Unable to perform automatic rollback after test suite. An implicit or explicit commit/rollback occurred in procedures:
48+
ut3.ut_output_test_rollback.ba
49+
ut3.ut_output_test_rollback.aa
50+
ut3.ut_output_test_rollback.be
51+
ut3.ut_output_test_rollback.ae
52+
ut3.ut_output_test_rollback.be
53+
ut3.ut_output_test_rollback.t_manual
54+
ut3.ut_output_test_rollback.ae
55+
Use the "--%rollback(manual)" annotation or remove commit/rollback/ddl statements that are causing the issue.
56+
%
57+
Finished in % seconds
58+
2 tests, 0 failed, 0 errored, 0 disabled, 2 warning(s)%]';
3859

3960
--act
4061
select *
4162
bulk collect into l_output_data
42-
from table(ut.run(ut_varchar2_list('tst_documrep_mult_warn','tst_documrep_mult_warn2'),ut_documentation_reporter()));
63+
from table(ut.run(ut_varchar2_list('ut_output_test_rollback'),ut_documentation_reporter()));
4364

4465
l_output := ut_utils.table_to_clob(l_output_data);
4566

@@ -48,9 +69,9 @@ begin
4869
:test_result := ut_utils.tr_success;
4970
else
5071
dbms_output.put_line('Actual:"'||l_output||'"');
72+
dbms_output.put_line('Expected:"'||l_expected||'"');
5173
end if;
5274
end;
5375
/
5476

55-
drop package tst_documrep_mult_warn;
56-
drop package tst_documrep_mult_warn2;
77+
drop package ut_output_test_rollback;

tests/ut_test/ut_test.ReportWarningOnRollbackFailed.sql

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,20 @@ begin
2929
l_results := ut_utils.table_to_clob(l_lines);
3030

3131
--assert
32-
if l_results like '%Warnings:%Unable to perform automatic rollback after test suite: ut_output_test_rollback%
33-
An implicit or explicit commit/rollback occurred.%
34-
Use the %rollback(manual) annotation or remove commits/rollback/ddl statements that are causing the issue.%0 disabled, 1 warning(s)%' then
32+
if l_results like q'[%Warnings:
33+
%
34+
1) ut_output_test_rollback.tt
35+
Unable to perform automatic rollback after test. An implicit or explicit commit/rollback occurred in procedures:
36+
ut3.ut_output_test_rollback.tt
37+
Use the "--%rollback(manual)" annotation or remove commit/rollback/ddl statements that are causing the issue.
38+
%
39+
2) ut_output_test_rollback
40+
Unable to perform automatic rollback after test suite. An implicit or explicit commit/rollback occurred in procedures:
41+
ut3.ut_output_test_rollback.tt
42+
Use the "--%rollback(manual)" annotation or remove commit/rollback/ddl statements that are causing the issue.
43+
%
44+
Finished in % seconds
45+
1 tests, 0 failed, 0 errored, 0 disabled, 2 warning(s)%]' then
3546
:test_result := ut_utils.tr_success;
3647
else
3748
for i in 1 .. l_lines.count loop

0 commit comments

Comments
 (0)