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

Skip to content

Commit 6fd6eff

Browse files
authored
Merge branch 'develop' into issue-378
2 parents 2c168f2 + 380ff54 commit 6fd6eff

9 files changed

Lines changed: 124 additions & 4 deletions

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)||']*(\(.*?\)\s*?$)?';
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 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
@@ -187,6 +188,7 @@ exec ut_coverage.coverage_start_develop();
187188
@@lib/RunTest.sql ut_suite_manager/ut_suite_manager.TestWithDollarSign.sql
188189
@@lib/RunTest.sql ut_suite_manager/ut_suite_manager.PackageWithHash.sql
189190
@@lib/RunTest.sql ut_suite_manager/ut_suite_manager.TestWithHashSign.sql
191+
@@lib/RunTest.sql ut_suite_manager/ut_suite_manager.emptySuitePath.sql
190192

191193

192194
@@lib/RunTest.sql ut_test/ut_test.DisabledFlagSkipTest.sql
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
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_expected.package_annotations('suite').params := cast( null as ut_annotations.tt_annotation_params);
25+
26+
l_ann_param := null;
27+
l_ann_param.val := 'all.globaltests';
28+
l_expected.package_annotations('suitepath').params(1) := l_ann_param;
29+
30+
check_annotation_parsing(l_expected, l_parsing_result);
31+
32+
if ut_expectation_processor.get_status = ut_utils.tr_success then
33+
:test_result := ut_utils.tr_success;
34+
end if;
35+
36+
end;
37+
/

tests/ut_suite_manager/ut_suite_manager.PackageWithDollarSign.sql

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,16 @@ set termout on
1717

1818
declare
1919
l_objects_to_run ut_suite_items;
20+
l_suite ut_suite;
2021
begin
2122
--act
2223
l_objects_to_run := ut_suite_manager.configure_execution_by_path(ut_varchar2_list('tst_package_with$dollar'));
24+
25+
--Assert
26+
ut.expect(l_objects_to_run.count).to_equal(1);
27+
28+
l_suite := treat(l_objects_to_run(1) as ut_suite);
29+
ut.expect(l_suite.name).to_equal('tst_package_with$dollar');
2330

2431
if ut_expectation_processor.get_status = ut_utils.tr_success then
2532
:test_result := ut_utils.tr_success;

tests/ut_suite_manager/ut_suite_manager.PackageWithHash.sql

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,18 @@ set termout on
1717

1818
declare
1919
l_objects_to_run ut_suite_items;
20+
l_suite ut_suite;
2021
begin
2122

2223
--act
2324
l_objects_to_run := ut_suite_manager.configure_execution_by_path(ut_varchar2_list('tst_package_with#hash'));
2425

26+
--Assert
27+
ut.expect(l_objects_to_run.count).to_equal(1);
28+
29+
l_suite := treat(l_objects_to_run(1) as ut_suite);
30+
ut.expect(l_suite.name).to_equal('tst_package_with#hash');
31+
2532
if ut_expectation_processor.get_status = ut_utils.tr_success then
2633
:test_result := ut_utils.tr_success;
2734
end if;

tests/ut_suite_manager/ut_suite_manager.TestWithDollarSign.sql

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,30 @@ end;
99

1010
create or replace package body tst_package_with_dollar_test as
1111
procedure test$1 is begin ut.expect(1).to_equal(1); end;
12-
procedure test$2 is begin ut.expect(1).to_equal(1); end;
1312
end;
1413
/
1514

1615
set termout on
1716

1817
declare
1918
l_objects_to_run ut_suite_items;
19+
l_suite ut_suite;
20+
l_test ut_test;
2021
begin
2122
--act
2223
l_objects_to_run := ut_suite_manager.configure_execution_by_path(ut_varchar2_list('tst_package_with_dollar_test.test$1'));
24+
25+
--Assert
26+
ut.expect(l_objects_to_run.count).to_equal(1);
27+
28+
l_suite := treat(l_objects_to_run(1) as ut_suite);
29+
30+
ut.expect(l_suite.name).to_equal('tst_package_with_dollar_test');
31+
ut.expect(l_suite.items.count).to_equal(1);
32+
33+
l_test := treat(l_suite.items(1) as ut_test);
34+
35+
ut.expect(l_test.name).to_equal('test$1');
2336

2437
if ut_expectation_processor.get_status = ut_utils.tr_success then
2538
:test_result := ut_utils.tr_success;

tests/ut_suite_manager/ut_suite_manager.TestWithHashSign.sql

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,31 @@ end;
99

1010
create or replace package body tst_package_with_hash_test as
1111
procedure test#1 is begin ut.expect(1).to_equal(1); end;
12-
procedure test#2 is begin ut.expect(1).to_equal(1); end;
1312
end;
1413
/
1514

1615
set termout on
1716

1817
declare
1918
l_objects_to_run ut_suite_items;
19+
l_suite ut_suite;
20+
l_test ut_test;
2021
begin
2122

2223
--act
2324
l_objects_to_run := ut_suite_manager.configure_execution_by_path(ut_varchar2_list('tst_package_with_hash_test.test#1'));
25+
26+
--Assert
27+
ut.expect(l_objects_to_run.count).to_equal(1);
28+
29+
l_suite := treat(l_objects_to_run(1) as ut_suite);
30+
31+
ut.expect(l_suite.name).to_equal('tst_package_with_hash_test');
32+
ut.expect(l_suite.items.count).to_equal(1);
33+
34+
l_test := treat(l_suite.items(1) as ut_test);
35+
36+
ut.expect(l_test.name).to_equal('test#1');
2437

2538
if ut_expectation_processor.get_status = ut_utils.tr_success then
2639
:test_result := ut_utils.tr_success;
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
set termout off
2+
create or replace package tst_empty_suite_path as
3+
--%suite
4+
--%suitepath
5+
6+
--%test
7+
procedure test1;
8+
end;
9+
/
10+
11+
create or replace package body tst_empty_suite_path as
12+
procedure test1 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+
l_suite ut_suite;
21+
begin
22+
23+
--act
24+
l_objects_to_run := ut_suite_manager.configure_execution_by_path(ut_varchar2_list('tst_empty_suite_path'));
25+
26+
--Assert
27+
ut.expect(l_objects_to_run.count).to_equal(1);
28+
29+
l_suite := treat(l_objects_to_run(1) as ut_suite);
30+
31+
ut.expect(l_suite.name).to_equal('tst_empty_suite_path');
32+
33+
if ut_expectation_processor.get_status = ut_utils.tr_success then
34+
:test_result := ut_utils.tr_success;
35+
end if;
36+
37+
end;
38+
/
39+
40+
drop package tst_empty_suite_path
41+
/

0 commit comments

Comments
 (0)