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

Skip to content

Commit 03361e5

Browse files
committed
additional test for comment-annotation mix
1 parent 207faa9 commit 03361e5

2 files changed

Lines changed: 46 additions & 0 deletions

File tree

tests/RunAll.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,10 @@ set serveroutput on size unlimited format truncated
101101
@@lib/RunTest.sql ut_annotations/ut_annotations.parse_package_annotations.ParsePackageLevelAnnotationWithKeyValue.sql
102102
@@lib/RunTest.sql ut_annotations/ut_annotations.parse_package_annotations.ParseAnnotationNotBeforeProcedure.sql
103103
@@lib/RunTest.sql ut_annotations/ut_annotations.parse_package_annotations.ParsePackageAndProcedureLevelAnnotations.sql
104+
@@lib/RunTest.sql ut_annotations/ut_annotations.parse_package_annotations.ParseAnnotationMixedWithWrongBeforeProcedure.sql
104105
@@lib/RunTest.sql ut_annotations/ut_annotations.parse_package_annotations.ParseComplexPackage.sql
105106

107+
106108
--Global cleanup
107109
drop package ut_example_tests;
108110
drop procedure check_annotation_parsing;
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
PROMPT Parse procedure level annotations with annotations mixed with comments
2+
3+
--Arrange
4+
declare
5+
l_source clob;
6+
l_parsing_result ut_annotations.typ_annotated_package;
7+
l_expected ut_annotations.typ_annotated_package;
8+
l_ann_param ut_annotations.typ_annotation_param;
9+
10+
begin
11+
l_source := 'PACKAGE test_tt AS
12+
-- %suite(Name of suite)
13+
-- %suitepackage(all.globaltests)
14+
15+
-- %ann1(Name of suite)
16+
-- wrong line
17+
-- %ann2(some_value)
18+
procedure foo;
19+
END;';
20+
21+
--Act
22+
l_parsing_result := ut_annotations.parse_package_annotations(l_source);
23+
24+
--Assert
25+
l_ann_param := null;
26+
l_ann_param.value := 'Name of suite';
27+
l_expected.package_annotations('suite')(1) := l_ann_param;
28+
29+
l_ann_param := null;
30+
l_ann_param.value := 'all.globaltests';
31+
l_expected.package_annotations('suitepackage')(1) := l_ann_param;
32+
33+
l_ann_param := null;
34+
l_ann_param.value := 'some_value';
35+
l_expected.procedure_annotations('foo')('ann2')(1) := l_ann_param;
36+
37+
check_annotation_parsing(l_expected, l_parsing_result);
38+
39+
if ut_assert.get_aggregate_asserts_result = ut_utils.tr_success then
40+
:test_result := ut_utils.tr_success;
41+
end if;
42+
43+
end;
44+
/

0 commit comments

Comments
 (0)