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

Skip to content

Commit 64cab8e

Browse files
committed
fix error with space before annotation params
1 parent 9b77fda commit 64cab8e

5 files changed

Lines changed: 76 additions & 2 deletions

File tree

source/core/ut_annotations.pkb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ create or replace package body ut_annotations as
3030
c_rgexp_identifier constant varchar2(50) := '[a-z][a-z0-9#_$]*';
3131
c_annotation_block_pattern constant varchar2(200) := '(({COMMENT#.+}'||chr(10)||')+)( |'||chr(09)||')*(procedure|function)\s+(' ||
3232
c_rgexp_identifier || ')';
33-
c_annotation_pattern constant varchar2(50) := gc_annotation_qualifier || c_rgexp_identifier || '(\(.*?\)$)?';
33+
c_annotation_pattern constant varchar2(50) := gc_annotation_qualifier || c_rgexp_identifier || '[ '||chr(9)||']*(\(.*?\)$)?';
3434

3535

3636
function delete_multiline_comments(a_source in clob) return clob is

source/core/ut_suite_manager.pkb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ create or replace package body ut_suite_manager is
8484
l_suite_name := l_annotation_data.package_annotations('suite').text;
8585
end if;
8686

87-
if l_annotation_data.package_annotations.exists('suitepath') then
87+
if l_annotation_data.package_annotations.exists('suitepath') and trim(l_annotation_data.package_annotations('suitepath').text) is not null then
8888
l_suite_path := l_annotation_data.package_annotations('suitepath').text || '.' || lower(l_object_name);
8989
end if;
9090

tests/RunAll.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ exec ut_coverage.coverage_start_develop();
4444
@@lib/RunTest.sql ut_annotations/ut_annotations.parse_package_annotations.ParsePackageLevelAnnotationMultilineDeclare.sql
4545
@@lib/RunTest.sql ut_annotations/ut_annotations.parse_package_annotations.ParsePackageLevelAnnotationWithKeyValue.sql
4646
@@lib/RunTest.sql ut_annotations/ut_annotations.parse_package_annotations.ParsePackageLevelAnnotationWithMultilineComment.sql
47+
@@lib/RunTest.sql ut_annotations/ut_annotations.parse_package_annotations.spaceBeforeAnnotationParams.sql
4748
@@ut_expectations/ut.expect.not_to_be_null.sql
4849
@@lib/RunTest.sql ut_expectations/ut.expect.to_be_false.GivesFailureWhenExpessionIsNotBoolean.sql
4950
@@lib/RunTest.sql ut_expectations/ut.expect.to_be_false.GivesFailureWhenExpessionIsNull.sql
@@ -183,6 +184,7 @@ exec ut_coverage.coverage_start_develop();
183184
@@lib/RunTest.sql ut_suite_manager/ut_suite_manager.TestWithDollarSign.sql
184185
@@lib/RunTest.sql ut_suite_manager/ut_suite_manager.PackageWithHash.sql
185186
@@lib/RunTest.sql ut_suite_manager/ut_suite_manager.TestWithHashSign.sql
187+
@@lib/RunTest.sql ut_suite_manager/ut_suite_manager.emptySuitePath.sql
186188

187189

188190
@@lib/RunTest.sql ut_test/ut_test.DisabledFlagSkipTest.sql
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
--Arrange
2+
declare
3+
l_source clob;
4+
l_parsing_result ut_annotations.typ_annotated_package;
5+
l_expected ut_annotations.typ_annotated_package;
6+
l_ann_param ut_annotations.typ_annotation_param;
7+
8+
begin
9+
l_source := 'PACKAGE test_tt AS
10+
/*
11+
Some comment
12+
-- inlined
13+
*/
14+
-- %suite
15+
-- %suitepath (all.globaltests)
16+
17+
procedure foo;
18+
END;';
19+
20+
--Act
21+
l_parsing_result := ut_annotations.parse_package_annotations(l_source);
22+
23+
--Assert
24+
l_ann_param := null;
25+
l_ann_param.val := 'Name of suite';
26+
l_expected.package_annotations('suite').params := cast( null as ut_annotations.tt_annotation_params);
27+
28+
l_ann_param := null;
29+
l_ann_param.val := 'all.globaltests';
30+
l_expected.package_annotations('suitepath').params(1) := l_ann_param;
31+
32+
check_annotation_parsing(l_expected, l_parsing_result);
33+
34+
if ut_expectation_processor.get_status = ut_utils.tr_success then
35+
:test_result := ut_utils.tr_success;
36+
end if;
37+
38+
end;
39+
/
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
set termout off
2+
create or replace package tst_empty_suite_path as
3+
--%suite
4+
--%suitepath
5+
6+
--%test
7+
procedure test#1;
8+
end;
9+
/
10+
11+
create or replace package body tst_empty_suite_path as
12+
procedure test#1 is begin ut.expect(1).to_equal(1); end;
13+
end;
14+
/
15+
16+
set termout on
17+
18+
declare
19+
l_objects_to_run ut_suite_items;
20+
begin
21+
22+
--act
23+
l_objects_to_run := ut_suite_manager.configure_execution_by_path(ut_varchar2_list('tst_empty_suite_path'));
24+
25+
if ut_expectation_processor.get_status = ut_utils.tr_success then
26+
:test_result := ut_utils.tr_success;
27+
end if;
28+
29+
end;
30+
/
31+
32+
drop package tst_empty_suite_path
33+
/

0 commit comments

Comments
 (0)