Skip to content

Commit a7aee89

Browse files
authored
Merge pull request #1361 from utPLSQL/bugfix/context_name_case_sensitivity
Fixed support for camelCase in context `--%name` annotation.
2 parents 6e2d874 + 98a6b3b commit a7aee89

4 files changed

Lines changed: 55 additions & 4 deletions

File tree

source/core/ut_suite_builder.pkb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -754,7 +754,7 @@ create or replace package body ut_suite_builder is
754754
l_used_context_names(l_context_name) := true;
755755

756756
l_context := ut_suite_context(a_parent.object_owner, a_parent.object_name, l_context_name, l_context_pos );
757-
l_context.path := a_parent.path||'.'||l_context_name;
757+
l_context.path := a_parent.path||'.'||l_context.name;
758758
l_context.description := coalesce( a_annotations.by_line( l_context_pos ).text, l_context_name );
759759
l_context.parse_time := a_annotations.parse_time;
760760

test/ut3_tester/core/test_suite_builder.pkb

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1370,6 +1370,54 @@ create or replace package body test_suite_builder is
13701370
);
13711371
end;
13721372

1373+
procedure context_name_case_insensitive is
1374+
l_actual clob;
1375+
l_annotations ut3_develop.ut_annotations;
1376+
begin
1377+
--Arrange
1378+
l_annotations := ut3_develop.ut_annotations(
1379+
ut3_develop.ut_annotation(1, 'suite','Cool', null),
1380+
ut3_develop.ut_annotation(2, 'beforeall',null, 'suite_level_beforeall'),
1381+
ut3_develop.ut_annotation(3, 'test','In suite', 'suite_level_test'),
1382+
ut3_develop.ut_annotation(4, 'context','A context', null),
1383+
ut3_develop.ut_annotation(5, 'name','a_Context', null),
1384+
ut3_develop.ut_annotation(6, 'beforeall',null, 'context_setup'),
1385+
ut3_develop.ut_annotation(7, 'test', 'In context', 'test_in_a_context'),
1386+
ut3_develop.ut_annotation(8, 'endcontext',null, null)
1387+
);
1388+
--Act
1389+
l_actual := invoke_builder_for_annotations(l_annotations, 'SOME_PACKAGE');
1390+
--Assert
1391+
ut.expect(l_actual).to_be_like(
1392+
'<ROWSET><ROW>'||
1393+
'<UT_LOGICAL_SUITE>' ||
1394+
'%<WARNINGS/>' ||
1395+
'%<ITEMS>' ||
1396+
'<UT_SUITE_ITEM>' ||
1397+
'%<NAME>suite_level_test</NAME><DESCRIPTION>In suite</DESCRIPTION><PATH>some_package.suite_level_test</PATH>' ||
1398+
'%</UT_SUITE_ITEM>' ||
1399+
'<UT_SUITE_ITEM>' ||
1400+
'%<NAME>a_context</NAME><DESCRIPTION>A context</DESCRIPTION><PATH>some_package.a_context</PATH>' ||
1401+
'%<ITEMS>' ||
1402+
'<UT_SUITE_ITEM>' ||
1403+
'%<NAME>test_in_a_context</NAME><DESCRIPTION>In context</DESCRIPTION><PATH>some_package.a_context.test_in_a_context</PATH>' ||
1404+
'%</UT_SUITE_ITEM>' ||
1405+
'</ITEMS>' ||
1406+
'<BEFORE_ALL_LIST>' ||
1407+
'%<OBJECT_NAME>some_package</OBJECT_NAME><PROCEDURE_NAME>context_setup</PROCEDURE_NAME>' ||
1408+
'%</BEFORE_ALL_LIST>' ||
1409+
'<AFTER_ALL_LIST/>' ||
1410+
'</UT_SUITE_ITEM>' ||
1411+
'</ITEMS>' ||
1412+
'<BEFORE_ALL_LIST>' ||
1413+
'%<OBJECT_NAME>some_package</OBJECT_NAME><PROCEDURE_NAME>suite_level_beforeall</PROCEDURE_NAME>' ||
1414+
'%</BEFORE_ALL_LIST>' ||
1415+
'<AFTER_ALL_LIST/>' ||
1416+
'</UT_LOGICAL_SUITE>'||
1417+
'</ROW></ROWSET>'
1418+
);
1419+
end;
1420+
13731421
procedure throws_value_empty is
13741422
l_actual clob;
13751423
l_annotations ut3_develop.ut_annotations;

test/ut3_tester/core/test_suite_builder.pks

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ create or replace package test_suite_builder is
142142
--%test(Falls back to default context name and gives warning when name contains spaces)
143143
procedure name_with_spaces_invalid;
144144

145-
--%test(Raises warning when more than one name annotation used )
145+
--%test(Raises warning when more than one name annotation used)
146146
procedure duplicate_name_annotation;
147147

148148
--%test(Is ignored when used outside of context - no warning given)
@@ -154,6 +154,9 @@ create or replace package test_suite_builder is
154154
--%test(Is applied to corresponding context when multiple contexts used)
155155
procedure multiple_contexts;
156156

157+
--%test(Context name is case insensitive)
158+
procedure context_name_case_insensitive;
159+
157160
--%endcontext
158161

159162
--%context(--%throws annotation)

test/ut3_user/reporters/test_tfs_junit_reporter.pkb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ create or replace package body test_tfs_junit_reporter as
100100
--%displayname(Test in and out of context)
101101

102102
-- %context(incontext)
103-
-- %name(ProductincontextFeatures)
103+
-- %name(Production_context_Features)
104104

105105
--%test(inctx)
106106
--%displayname(inctx)
@@ -298,7 +298,7 @@ create or replace package body test_tfs_junit_reporter as
298298
<testsuites>
299299
<testsuite tests="2" id="1" package="core.check_junit_inout_context" errors="0" failures="0" name="Test in and out of context" time="%" timestamp="%" hostname="%" >
300300
<properties/>
301-
<testcase classname="core.check_junit_inout_context.ProductincontextFeatures" name="inctx" time="%">
301+
<testcase classname="core.check_junit_inout_context.production_context_features" name="inctx" time="%">
302302
</testcase>
303303
<testcase classname="core.check_junit_inout_context" name="outctx" time="%">
304304
</testcase>

0 commit comments

Comments
 (0)