diff --git a/source/core/ut_suite_builder.pkb b/source/core/ut_suite_builder.pkb index d3de777db..101ab2179 100644 --- a/source/core/ut_suite_builder.pkb +++ b/source/core/ut_suite_builder.pkb @@ -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, @@ -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, @@ -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; @@ -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; @@ -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 := @@ -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( diff --git a/test/ut3_tester/core/test_suite_builder.pkb b/test/ut3_tester/core/test_suite_builder.pkb index 523d31a3d..b49ecb2da 100644 --- a/test/ut3_tester/core/test_suite_builder.pkb +++ b/test/ut3_tester/core/test_suite_builder.pkb @@ -619,7 +619,7 @@ create or replace package body test_suite_builder is ut.expect(l_actual).to_match('(.*)()(.*)(Annotation "--%beforeeach")(.*)(line 3)(.*)()(.*)', 'n'); ut.expect(l_actual).to_match('(.*)()(.*)(Annotation "--%aftereach")(.*)(line 4)(.*)()(.*)', 'n'); ut.expect(l_actual).to_match('(.*)()(.*)(Annotation "--%afterall" cannot be used with "--%test". Annotation ignored.)' - ||'(.*)(at "UT3_TESTER.SOME_PACKAGE.DO_STUFF", line 5)(.*)()(.*)', 'n'); + ||'(.*)(at package "UT3_TESTER.SOME_PACKAGE.DO_STUFF", line 5)(.*)()(.*)', 'n'); ut.expect(l_actual).not_to_be_like('%%'); ut.expect(l_actual).not_to_be_like('%%'); ut.expect(l_actual).not_to_be_like('%%'); @@ -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( - '%Invalid annotation "--\%context". Cannot find following "--\%endcontext". Annotation ignored.%at "UT3_TESTER.SOME_PACKAGE", line 4%' + '%Invalid annotation "--\%context". Cannot find following "--\%endcontext". Annotation ignored.%at package "UT3_TESTER.SOME_PACKAGE", line 4%' ,'\' ); ut.expect(l_actual).to_be_like( @@ -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( - '%Invalid annotation "--\%endcontext". Cannot find preceding "--\%context". Annotation ignored.%at "UT3_TESTER.SOME_PACKAGE", line 9%' + '%Invalid annotation "--\%endcontext". Cannot find preceding "--\%context". Annotation ignored.%at package "UT3_TESTER.SOME_PACKAGE", line 9%' ,'\' ); ut.expect(l_actual).to_be_like( @@ -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( - '%Context name must be unique in a suite. Context and all of it's content ignored.%at "UT3_TESTER.SOME_PACKAGE", line 9%' + '%Context name must be unique in a suite. Context and all of it's content ignored.%at package "UT3_TESTER.SOME_PACKAGE", line 9%' ,'\' ); ut.expect(l_actual).to_be_like(