Skip to content

Commit

Permalink
Fixed issue fit false-positive warnings on suites with multiple conte…
Browse files Browse the repository at this point in the history
…xts.
  • Loading branch information
jgebal committed Nov 2, 2019
1 parent 7740ec2 commit bc49a81
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 17 deletions.
1 change: 1 addition & 0 deletions source/core/ut_suite_builder.pkb
Original file line number Diff line number Diff line change
Expand Up @@ -800,6 +800,7 @@ create or replace package body ut_suite_builder is

while l_context_pos is not null loop
l_default_context_name := 'nested_context_#'||l_context_no;
l_context_name := null;
l_end_context_pos := get_endcontext_position(l_context_pos, a_annotations.by_name );

l_next_context_pos := a_annotations.by_name(gc_context).next(l_context_pos);
Expand Down
87 changes: 70 additions & 17 deletions test/ut3_tester/core/test_suite_builder.pkb
Original file line number Diff line number Diff line change
Expand Up @@ -1225,23 +1225,76 @@ create or replace package body test_suite_builder is
ut.expect(l_actual).to_be_like(
'<ROWSET><ROW>'||
'<UT_LOGICAL_SUITE>' ||
'%<ITEMS>' ||
'<UT_SUITE_ITEM>' ||
'%<NAME>nested_context_#1</NAME><DESCRIPTION>A context</DESCRIPTION><PATH>some_package.nested_context_#1</PATH>' ||
'%<ITEMS>' ||
'<UT_SUITE_ITEM>' ||
'%<NAME>test_in_a_context</NAME><DESCRIPTION>In context</DESCRIPTION><PATH>some_package.nested_context_#1.test_in_a_context</PATH>' ||
'%</UT_SUITE_ITEM>' ||
'</ITEMS>' ||
'<BEFORE_ALL_LIST/>' ||
'<AFTER_ALL_LIST/>' ||
'</UT_SUITE_ITEM>' ||
'<UT_SUITE_ITEM>' ||
'%<NAME>suite_level_test</NAME><DESCRIPTION>In suite</DESCRIPTION><PATH>some_package.suite_level_test</PATH>' ||
'%</UT_SUITE_ITEM>' ||
'</ITEMS>' ||
'<BEFORE_ALL_LIST/>' ||
'<AFTER_ALL_LIST/>' ||
'%<ITEMS>' ||
'<UT_SUITE_ITEM>' ||
'%<NAME>nested_context_#1</NAME><DESCRIPTION>A context</DESCRIPTION><PATH>some_package.nested_context_#1</PATH>' ||
'%<ITEMS>' ||
'<UT_SUITE_ITEM>' ||
'%<NAME>test_in_a_context</NAME><DESCRIPTION>In context</DESCRIPTION><PATH>some_package.nested_context_#1.test_in_a_context</PATH>' ||
'%</UT_SUITE_ITEM>' ||
'</ITEMS>' ||
'<BEFORE_ALL_LIST/>' ||
'<AFTER_ALL_LIST/>' ||
'</UT_SUITE_ITEM>' ||
'<UT_SUITE_ITEM>' ||
'%<NAME>suite_level_test</NAME><DESCRIPTION>In suite</DESCRIPTION><PATH>some_package.suite_level_test</PATH>' ||
'%</UT_SUITE_ITEM>' ||
'</ITEMS>' ||
'<BEFORE_ALL_LIST/>' ||
'<AFTER_ALL_LIST/>' ||
'</UT_LOGICAL_SUITE>'||
'</ROW></ROWSET>'
);
end;

procedure multiple_contexts is
l_actual clob;
l_annotations ut3.ut_annotations;
begin
--Arrange
l_annotations := ut3.ut_annotations(
ut3.ut_annotation(1, 'suite','Cool', null),
ut3.ut_annotation(4, 'context','A context', null),
ut3.ut_annotation(6, 'test', 'In context1', 'test_in_a_context1'),
ut3.ut_annotation(7, 'endcontext',null, null),
ut3.ut_annotation(8, 'context','A context', null),
ut3.ut_annotation(10, 'test', 'In context2', 'test_in_a_context2'),
ut3.ut_annotation(11, 'endcontext',null, null)
);
--Act
l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE');
--Assert
ut.expect(l_actual).to_be_like(
'%<WARNINGS/>%'
,'\'
);
ut.expect(l_actual).to_be_like(
'<ROWSET><ROW>'||
'<UT_LOGICAL_SUITE>' ||
'%<ITEMS>' ||
'<UT_SUITE_ITEM>' ||
'%<NAME>nested_context_#2</NAME><DESCRIPTION>A context</DESCRIPTION><PATH>some_package.nested_context_#2</PATH>' ||
'%<ITEMS>' ||
'<UT_SUITE_ITEM>' ||
'%<NAME>test_in_a_context2</NAME><DESCRIPTION>In context2</DESCRIPTION><PATH>some_package.nested_context_#2.test_in_a_context2</PATH>' ||
'%</UT_SUITE_ITEM>' ||
'</ITEMS>' ||
'<BEFORE_ALL_LIST/>' ||
'<AFTER_ALL_LIST/>' ||
'</UT_SUITE_ITEM>' ||
'<UT_SUITE_ITEM>' ||
'%<NAME>nested_context_#1</NAME><DESCRIPTION>A context</DESCRIPTION><PATH>some_package.nested_context_#1</PATH>' ||
'%<ITEMS>' ||
'<UT_SUITE_ITEM>' ||
'%<NAME>test_in_a_context1</NAME><DESCRIPTION>In context1</DESCRIPTION><PATH>some_package.nested_context_#1.test_in_a_context1</PATH>' ||
'%</UT_SUITE_ITEM>' ||
'</ITEMS>' ||
'<BEFORE_ALL_LIST/>' ||
'<AFTER_ALL_LIST/>' ||
'</UT_SUITE_ITEM>' ||
'</ITEMS>' ||
'<BEFORE_ALL_LIST/>' ||
'<AFTER_ALL_LIST/>' ||
'</UT_LOGICAL_SUITE>'||
'</ROW></ROWSET>'
);
Expand Down
3 changes: 3 additions & 0 deletions test/ut3_tester/core/test_suite_builder.pks
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,9 @@ create or replace package test_suite_builder is
--%test(Is ignored when name value is empty)
procedure name_empty_value;

--%test(Is ignored when name value is empty)
procedure multiple_contexts;

--%endcontext

--%context(--%throws annotation)
Expand Down

0 comments on commit bc49a81

Please sign in to comment.