Skip to content

Commit

Permalink
Merge e2ff899 into c83f419
Browse files Browse the repository at this point in the history
  • Loading branch information
jgebal committed Jul 2, 2019
2 parents c83f419 + e2ff899 commit 3aa380a
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 24 deletions.
47 changes: 27 additions & 20 deletions source/core/ut_suite_builder.pkb
Expand Up @@ -95,6 +95,27 @@ create or replace package body ut_suite_builder is
by_name tt_annotations_by_name
);

function get_qualified_object_name(
a_suite ut_suite_item, a_procedure_name t_object_name
) return varchar2 is
l_result varchar2(1000);
begin
if a_suite is not null then
l_result := upper( a_suite.object_owner || '.' || a_suite.object_name );
if a_procedure_name is not null then
l_result := l_result || upper( '.' || a_procedure_name );
end if;
end if;
return l_result;
end;

function get_object_reference(
a_suite ut_suite_item, a_procedure_name t_object_name, a_line_no binary_integer
) return varchar2 is
begin
return chr( 10 ) || 'at package "' || get_qualified_object_name(a_suite, a_procedure_name) || '", line ' || a_line_no;
end;

procedure delete_annotations_range(
a_annotations in out nocopy t_annotations_info,
a_start_pos t_annotation_position,
Expand Down Expand Up @@ -131,20 +152,6 @@ create or replace package body ut_suite_builder is
-- Processing annotations
-----------------------------------------------

function get_qualified_object_name(
a_suite ut_suite_item, a_procedure_name t_object_name
) return varchar2 is
l_result varchar2(1000);
begin
if a_suite is not null then
l_result := upper( a_suite.object_owner || '.' || a_suite.object_name );
if a_procedure_name is not null then
l_result := l_result || upper( '.' || a_procedure_name );
end if;
end if;
return l_result;
end;

procedure add_annotation_ignored_warning(
a_suite in out nocopy ut_suite_item,
a_annotation t_annotation_name,
Expand All @@ -154,8 +161,8 @@ create or replace package body ut_suite_builder is
) is
begin
a_suite.put_warning(
replace(a_message,'%%%','"--%'||a_annotation||'"') || ' Annotation ignored.'
|| chr( 10 ) || 'at "' || get_qualified_object_name(a_suite, a_procedure_name) || '", line ' || a_line_no
replace(a_message,'%%%','"--%'||a_annotation||'"')
|| ' Annotation ignored.' || get_object_reference( a_suite, a_procedure_name, a_line_no )
);
end;

Expand Down Expand Up @@ -271,8 +278,8 @@ create or replace package body ut_suite_builder is

if l_exception_number is null then
a_suite.put_warning(
'Invalid parameter value "'||l_throws_list(i)||'" for "--%throws" annotation. Parameter ignored.'
|| chr( 10 ) || 'at "' || get_qualified_object_name(a_suite, a_procedure_name) || '", line ' || a_line_no
'Invalid parameter value "'||l_throws_list(i)
||'" for "--%throws" annotation. Parameter ignored.'||get_object_reference( a_suite, a_procedure_name, a_line_no )
);
else
l_exception_number_list.extend;
Expand All @@ -291,7 +298,7 @@ create or replace package body ut_suite_builder is
if a_throws_ann_text(l_annotation_pos) is null then
a_suite.put_warning(
'"--%throws" annotation requires a parameter. Annotation ignored.'
|| chr( 10 ) || 'at "' || get_qualified_object_name(a_suite, a_procedure_name) || '", line ' || l_annotation_pos
|| get_object_reference( a_suite, a_procedure_name, l_annotation_pos )
);
else
a_list :=
Expand Down Expand Up @@ -321,7 +328,7 @@ create or replace package body ut_suite_builder is
if a_tags_ann_text(l_annotation_pos) is null then
a_suite.put_warning(
'"--%tags" annotation requires a tag value populated. Annotation ignored.'
|| chr( 10 ) || 'at "' || get_qualified_object_name(a_suite, a_procedure_name) || '", line ' || l_annotation_pos
|| get_object_reference( a_suite, a_procedure_name, l_annotation_pos )
);
else
l_tag_list := l_tag_list multiset union distinct ut_utils.trim_list_elements(
Expand Down
8 changes: 4 additions & 4 deletions test/ut3_tester/core/test_suite_builder.pkb
Expand Up @@ -619,7 +619,7 @@ create or replace package body test_suite_builder is
ut.expect(l_actual).to_match('(.*)(<WARNINGS>)(.*)(Annotation &quot;--%beforeeach&quot;)(.*)(line 3)(.*)(</WARNINGS>)(.*)', 'n');
ut.expect(l_actual).to_match('(.*)(<WARNINGS>)(.*)(Annotation &quot;--%aftereach&quot;)(.*)(line 4)(.*)(</WARNINGS>)(.*)', 'n');
ut.expect(l_actual).to_match('(.*)(<WARNINGS>)(.*)(Annotation &quot;--%afterall&quot; cannot be used with &quot;--%test&quot;. Annotation ignored.)'
||'(.*)(at &quot;UT3_TESTER.SOME_PACKAGE.DO_STUFF&quot;, line 5)(.*)(</WARNINGS>)(.*)', 'n');
||'(.*)(at package &quot;UT3_TESTER.SOME_PACKAGE.DO_STUFF&quot;, line 5)(.*)(</WARNINGS>)(.*)', 'n');
ut.expect(l_actual).not_to_be_like('%<BEFORE_EACH_LIST>%');
ut.expect(l_actual).not_to_be_like('%<AFTER_EACH_LIST>%');
ut.expect(l_actual).not_to_be_like('%<BEFORE_ALL_LIST>%');
Expand Down Expand Up @@ -791,7 +791,7 @@ create or replace package body test_suite_builder is
l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE');
--Assert
ut.expect(l_actual).to_be_like(
'%<WARNINGS><VARCHAR2>Invalid annotation &quot;--\%context&quot;. Cannot find following &quot;--\%endcontext&quot;. Annotation ignored.%at &quot;UT3_TESTER.SOME_PACKAGE&quot;, line 4</VARCHAR2></WARNINGS>%'
'%<WARNINGS><VARCHAR2>Invalid annotation &quot;--\%context&quot;. Cannot find following &quot;--\%endcontext&quot;. Annotation ignored.%at package &quot;UT3_TESTER.SOME_PACKAGE&quot;, line 4</VARCHAR2></WARNINGS>%'
,'\'
);
ut.expect(l_actual).to_be_like(
Expand Down Expand Up @@ -835,7 +835,7 @@ create or replace package body test_suite_builder is
l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE');
--Assert
ut.expect(l_actual).to_be_like(
'%<WARNINGS><VARCHAR2>Invalid annotation &quot;--\%endcontext&quot;. Cannot find preceding &quot;--\%context&quot;. Annotation ignored.%at &quot;UT3_TESTER.SOME_PACKAGE&quot;, line 9</VARCHAR2></WARNINGS>%'
'%<WARNINGS><VARCHAR2>Invalid annotation &quot;--\%endcontext&quot;. Cannot find preceding &quot;--\%context&quot;. Annotation ignored.%at package &quot;UT3_TESTER.SOME_PACKAGE&quot;, line 9</VARCHAR2></WARNINGS>%'
,'\'
);
ut.expect(l_actual).to_be_like(
Expand Down Expand Up @@ -892,7 +892,7 @@ create or replace package body test_suite_builder is
l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE');
--Assert
ut.expect(l_actual).to_be_like(
'%<WARNINGS><VARCHAR2>Context name must be unique in a suite. Context and all of it&apos;s content ignored.%at &quot;UT3_TESTER.SOME_PACKAGE&quot;, line 9</VARCHAR2></WARNINGS>%'
'%<WARNINGS><VARCHAR2>Context name must be unique in a suite. Context and all of it&apos;s content ignored.%at package &quot;UT3_TESTER.SOME_PACKAGE&quot;, line 9</VARCHAR2></WARNINGS>%'
,'\'
);
ut.expect(l_actual).to_be_like(
Expand Down

0 comments on commit 3aa380a

Please sign in to comment.