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

Skip to content

Commit 7dcd62c

Browse files
authored
Merge pull request #347 from jgebal/bugfix/test_description_with_comma
Bugfix/test description with comma
2 parents a43e3ff + 84d7860 commit 7dcd62c

16 files changed

Lines changed: 127 additions & 59 deletions

source/core/ut_annotations.pkb

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ create or replace package body ut_annotations as
4848
l_annotation_params_str varchar2(32767);
4949
l_annotation_name varchar2(1000);
5050
l_annotation_params tt_annotation_params;
51+
l_annotation t_annotation;
5152
l_annotations_list tt_annotations;
5253
begin
5354
-- loop while there are unprocessed comment blocks
@@ -102,8 +103,9 @@ create or replace package body ut_annotations as
102103
end;
103104
end loop;
104105
end if;
105-
106-
l_annotations_list(l_annotation_name) := l_annotation_params;
106+
l_annotation.text := l_annotation_params_str;
107+
l_annotation.params := l_annotation_params;
108+
l_annotations_list(l_annotation_name) := l_annotation;
107109
end if;
108110
l_loop_index := l_loop_index + 1;
109111
end loop;
@@ -324,14 +326,14 @@ create or replace package body ut_annotations as
324326
end if;
325327
end;
326328

327-
function get_annotation_param(a_param_list tt_annotation_params, a_def_index pls_integer) return varchar2 is
328-
l_result varchar2(32767);
329-
begin
330-
if a_param_list.exists(a_def_index) then
331-
l_result := a_param_list(a_def_index).val;
332-
end if;
333-
return l_result;
334-
end get_annotation_param;
329+
-- function get_annotation_param(a_param_list tt_annotation_params, a_def_index pls_integer) return varchar2 is
330+
-- l_result varchar2(32767);
331+
-- begin
332+
-- if a_param_list.exists(a_def_index) then
333+
-- l_result := a_param_list(a_def_index).val;
334+
-- end if;
335+
-- return l_result;
336+
-- end get_annotation_param;
335337

336338
end ut_annotations;
337339
/

source/core/ut_annotations.pks

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,16 @@ create or replace package ut_annotations authid current_user as
4646
*/
4747
type tt_annotation_params is table of typ_annotation_param index by pls_integer;
4848

49+
type t_annotation is record(
50+
text varchar2(4000),
51+
params tt_annotation_params
52+
);
53+
4954
/*
5055
type: tt_annotations
5156
a list of tt_annotation_params index by the annotation name
5257
*/
53-
type tt_annotations is table of tt_annotation_params index by t_annotation_name;
58+
type tt_annotations is table of t_annotation index by t_annotation_name;
5459

5560
/*
5661
type: tt_procedure_annotations
@@ -87,7 +92,7 @@ create or replace package ut_annotations authid current_user as
8792

8893
get annotation parameter on a specified index position
8994
*/
90-
function get_annotation_param(a_param_list tt_annotation_params, a_def_index pls_integer) return varchar2;
95+
-- function get_annotation_param(a_param_list tt_annotation_params, a_def_index pls_integer) return varchar2;
9196

9297
end ut_annotations;
9398
/

source/core/ut_suite_manager.pkb

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -79,19 +79,17 @@ create or replace package body ut_suite_manager is
7979
if l_annotation_data.package_annotations.exists('suite') then
8080

8181
if l_annotation_data.package_annotations.exists('displayname') then
82-
l_suite_name := ut_annotations.get_annotation_param(l_annotation_data.package_annotations('displayname'), 1);
83-
elsif l_annotation_data.package_annotations('suite').count>0 then
84-
l_suite_name := ut_annotations.get_annotation_param(l_annotation_data.package_annotations('suite'), 1);
82+
l_suite_name := l_annotation_data.package_annotations('displayname').text;
83+
else
84+
l_suite_name := l_annotation_data.package_annotations('suite').text;
8585
end if;
8686

8787
if l_annotation_data.package_annotations.exists('suitepath') then
88-
l_suite_path := ut_annotations.get_annotation_param(l_annotation_data.package_annotations('suitepath'), 1) || '.' ||
89-
lower(l_object_name);
88+
l_suite_path := l_annotation_data.package_annotations('suitepath').text || '.' || lower(l_object_name);
9089
end if;
9190

9291
if l_annotation_data.package_annotations.exists('rollback') then
93-
l_suite_rollback_annotation := ut_annotations.get_annotation_param(l_annotation_data.package_annotations('rollback')
94-
,1);
92+
l_suite_rollback_annotation := l_annotation_data.package_annotations('rollback').text;
9593
l_suite_rollback := case lower(l_suite_rollback_annotation)
9694
when 'manual' then
9795
ut_utils.gc_rollback_manual
@@ -145,21 +143,21 @@ create or replace package body ut_suite_manager is
145143
l_displayname varchar2(4000);
146144
begin
147145
if l_proc_annotations.exists('beforetest') then
148-
l_beforetest_procedure := ut_annotations.get_annotation_param(l_proc_annotations('beforetest'), 1);
146+
l_beforetest_procedure := l_proc_annotations('beforetest').text;
149147
end if;
150148

151149
if l_proc_annotations.exists('aftertest') then
152-
l_aftertest_procedure := ut_annotations.get_annotation_param(l_proc_annotations('aftertest'), 1);
150+
l_aftertest_procedure := l_proc_annotations('aftertest').text;
153151
end if;
154152

155153
if l_proc_annotations.exists('displayname') then
156-
l_displayname := ut_annotations.get_annotation_param(l_proc_annotations('displayname'), 1);
157-
elsif l_proc_annotations('test').count > 0 then
158-
l_displayname := ut_annotations.get_annotation_param(l_proc_annotations('test'), 1);
154+
l_displayname := l_proc_annotations('displayname').text;
155+
else
156+
l_displayname := l_proc_annotations('test').text;
159157
end if;
160158

161159
if l_proc_annotations.exists('rollback') then
162-
l_rollback_annotation := ut_annotations.get_annotation_param(l_proc_annotations('rollback'), 1);
160+
l_rollback_annotation := l_proc_annotations('rollback').text;
163161
l_rollback_type := case lower(l_rollback_annotation)
164162
when 'manual' then
165163
ut_utils.gc_rollback_manual

tests/RunAll.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ exec ut_coverage.coverage_start_develop();
156156
@@lib/RunTest.sql ut/ut.run.WithSuitePath.ExecutesAllFromGivenPath.sql
157157
@@lib/RunTest.sql ut/ut.version.sql
158158

159+
@@lib/RunTest.sql ut_suite_manager/ut_suite_manager.AllowsDescriptionsWithComma.sql
159160
@@lib/RunTest.sql ut_suite_manager/ut_suite_manager.configure_execution_by_path.PrepareRunnerForTheSchema.sql
160161
@@lib/RunTest.sql ut_suite_manager/ut_suite_manager.configure_execution_by_path.PrepareRunnerForTheTopPackageByPath.sql
161162
@@lib/RunTest.sql ut_suite_manager/ut_suite_manager.configure_execution_by_path.PrepareRunnerForTheTopPackageByPathCurUser.sql

tests/helpers/check_annotation_parsing.prc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ create or replace procedure check_annotation_parsing(a_expected ut_annotations.t
3131

3232
ut.expect(a_actual.exists(l_ind),('['||a_msg||']Check annotation exists')).to_be_true;
3333
if a_actual.exists(l_ind) then
34-
check_annotation_params(a_msg||'.'||l_ind,a_expected(l_ind),a_actual(l_ind));
34+
check_annotation_params(a_msg||'.'||l_ind,a_expected(l_ind).params,a_actual(l_ind).params);
3535
end if;
3636
l_ind := a_expected.next(l_ind);
3737
end loop;

tests/ut_annotations/ut_annotations.parse_package_annotations.ParseAnnotationMixedWithWrongBeforeProcedure.sql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,17 @@ END;';
2525
--Assert
2626
l_ann_param := null;
2727
l_ann_param.val := 'Name of suite';
28-
l_expected.package_annotations('suite') := cast( null as ut_annotations.tt_annotation_params);
29-
l_expected.package_annotations('displayname')(1) := l_ann_param;
28+
l_expected.package_annotations('suite').params := cast( null as ut_annotations.tt_annotation_params);
29+
l_expected.package_annotations('displayname').params(1) := l_ann_param;
3030

3131
l_ann_param := null;
3232
l_ann_param.val := 'all.globaltests';
33-
l_expected.package_annotations('suitepath')(1) := l_ann_param;
33+
l_expected.package_annotations('suitepath').params(1) := l_ann_param;
3434

3535
l_ann_param := null;
3636
l_ann_param.val := 'some_value';
3737
l_expected.procedure_annotations(1).name :='foo';
38-
l_expected.procedure_annotations(1).annotations('ann2')(1) := l_ann_param;
38+
l_expected.procedure_annotations(1).annotations('ann2').params(1) := l_ann_param;
3939

4040
check_annotation_parsing(l_expected, l_parsing_result);
4141

tests/ut_annotations/ut_annotations.parse_package_annotations.ParseAnnotationNotBeforeProcedure.sql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ END;';
2525
--Assert
2626
l_ann_param := null;
2727
l_ann_param.val := 'Name of suite';
28-
l_expected.package_annotations('suite') := cast( null as ut_annotations.tt_annotation_params);
29-
l_expected.package_annotations('displayname')(1) := l_ann_param;
28+
l_expected.package_annotations('suite').params := cast( null as ut_annotations.tt_annotation_params);
29+
l_expected.package_annotations('displayname').params(1) := l_ann_param;
3030

3131
l_ann_param := null;
3232
l_ann_param.val := 'all.globaltests';
33-
l_expected.package_annotations('suitepath')(1) := l_ann_param;
33+
l_expected.package_annotations('suitepath').params(1) := l_ann_param;
3434

3535
check_annotation_parsing(l_expected, l_parsing_result);
3636

tests/ut_annotations/ut_annotations.parse_package_annotations.ParseAnnotationParamsWithBrackets.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ END;';
1717

1818
--Assert
1919
l_ann_param.val := 'Name of suite (including some brackets) and some more text';
20-
l_expected.package_annotations('suite')(1) := l_ann_param;
20+
l_expected.package_annotations('suite').params(1) := l_ann_param;
2121

2222
check_annotation_parsing(l_expected, l_parsing_result);
2323

tests/ut_annotations/ut_annotations.parse_package_annotations.ParseComplexPackage.sql

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,18 @@ END;';
4040
--Assert
4141
l_ann_param := null;
4242
l_ann_param.val := 'Name of suite';
43-
l_expected.package_annotations('suite') := cast( null as ut_annotations.tt_annotation_params);
44-
l_expected.package_annotations('displayname')(1) := l_ann_param;
43+
l_expected.package_annotations('suite').params := cast( null as ut_annotations.tt_annotation_params);
44+
l_expected.package_annotations('displayname').params(1) := l_ann_param;
4545

4646
l_ann_param := null;
4747
l_ann_param.val := 'all.globaltests';
48-
l_expected.package_annotations('suitepath')(1) := l_ann_param;
48+
l_expected.package_annotations('suitepath').params(1) := l_ann_param;
4949

5050
l_expected.procedure_annotations(1).name := 'foo';
51-
l_expected.procedure_annotations(1).annotations('test') := cast( null as ut_annotations.tt_annotation_params);
51+
l_expected.procedure_annotations(1).annotations('test').params := cast( null as ut_annotations.tt_annotation_params);
5252

5353
l_expected.procedure_annotations(2).name := 'foo2';
54-
l_expected.procedure_annotations(2).annotations('beforeeach') := cast( null as ut_annotations.tt_annotation_params);
54+
l_expected.procedure_annotations(2).annotations('beforeeach').params := cast( null as ut_annotations.tt_annotation_params);
5555

5656
l_ann_param := null;
5757
l_ann_param.key := 'key';

tests/ut_annotations/ut_annotations.parse_package_annotations.ParsePackageAndProcedureLevelAnnotations.sql

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ END;';
2323
--Assert
2424
l_ann_param := null;
2525
l_ann_param.val := 'Name of suite';
26-
l_expected.package_annotations('suite') := cast( null as ut_annotations.tt_annotation_params);
27-
l_expected.package_annotations('displayname')(1) := l_ann_param;
26+
l_expected.package_annotations('suite').params := cast( null as ut_annotations.tt_annotation_params);
27+
l_expected.package_annotations('displayname').params(1) := l_ann_param;
2828

2929
l_ann_param := null;
3030
l_ann_param.val := 'all.globaltests';
31-
l_expected.package_annotations('suitepath')(1) := l_ann_param;
31+
l_expected.package_annotations('suitepath').params(1) := l_ann_param;
3232

3333
l_expected.procedure_annotations(1).name := 'foo';
34-
l_expected.procedure_annotations(1).annotations('test') := cast( null as ut_annotations.tt_annotation_params);
34+
l_expected.procedure_annotations(1).annotations('test').params := cast( null as ut_annotations.tt_annotation_params);
3535

3636
check_annotation_parsing(l_expected, l_parsing_result);
3737

0 commit comments

Comments
 (0)