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

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion source/core/ut_annotations.pkb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ create or replace package body ut_annotations as
c_rgexp_identifier constant varchar2(50) := '[a-z][a-z0-9#_$]*';
c_annotation_block_pattern constant varchar2(200) := '(({COMMENT#.+}'||chr(10)||')+)( |'||chr(09)||')*(procedure|function)\s+(' ||
c_rgexp_identifier || ')';
c_annotation_pattern constant varchar2(50) := gc_annotation_qualifier || c_rgexp_identifier || '(\(.*?\)$)?';
c_annotation_pattern constant varchar2(50) := gc_annotation_qualifier || c_rgexp_identifier || '[ '||chr(9)||']*(\(.*?\)\s*?$)?';


function delete_multiline_comments(a_source in clob) return clob is
Expand Down
2 changes: 1 addition & 1 deletion source/core/ut_suite_manager.pkb
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ create or replace package body ut_suite_manager is
l_suite_name := l_annotation_data.package_annotations('suite').text;
end if;

if l_annotation_data.package_annotations.exists('suitepath') then
if l_annotation_data.package_annotations.exists('suitepath') and l_annotation_data.package_annotations('suitepath').text is not null then
l_suite_path := l_annotation_data.package_annotations('suitepath').text || '.' || lower(l_object_name);
end if;

Expand Down
2 changes: 2 additions & 0 deletions tests/RunAll.sql
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ exec ut_coverage.coverage_start_develop();
@@lib/RunTest.sql ut_annotations/ut_annotations.parse_package_annotations.ParsePackageLevelAnnotationMultilineDeclare.sql
@@lib/RunTest.sql ut_annotations/ut_annotations.parse_package_annotations.ParsePackageLevelAnnotationWithKeyValue.sql
@@lib/RunTest.sql ut_annotations/ut_annotations.parse_package_annotations.ParsePackageLevelAnnotationWithMultilineComment.sql
@@lib/RunTest.sql ut_annotations/ut_annotations.parse_package_annotations.spaceBeforeAnnotationParams.sql
@@ut_expectations/ut.expect.not_to_be_null.sql
@@lib/RunTest.sql ut_expectations/ut.expect.to_be_false.GivesFailureWhenExpessionIsNotBoolean.sql
@@lib/RunTest.sql ut_expectations/ut.expect.to_be_false.GivesFailureWhenExpessionIsNull.sql
Expand Down Expand Up @@ -185,6 +186,7 @@ exec ut_coverage.coverage_start_develop();
@@lib/RunTest.sql ut_suite_manager/ut_suite_manager.TestWithDollarSign.sql
@@lib/RunTest.sql ut_suite_manager/ut_suite_manager.PackageWithHash.sql
@@lib/RunTest.sql ut_suite_manager/ut_suite_manager.TestWithHashSign.sql
@@lib/RunTest.sql ut_suite_manager/ut_suite_manager.emptySuitePath.sql


@@lib/RunTest.sql ut_test/ut_test.DisabledFlagSkipTest.sql
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
--Arrange
declare
l_source clob;
l_parsing_result ut_annotations.typ_annotated_package;
l_expected ut_annotations.typ_annotated_package;
l_ann_param ut_annotations.typ_annotation_param;

begin
l_source := 'PACKAGE test_tt AS
/*
Some comment
-- inlined
*/
-- %suite
-- %suitepath (all.globaltests)

procedure foo;
END;';

--Act
l_parsing_result := ut_annotations.parse_package_annotations(l_source);

--Assert
l_expected.package_annotations('suite').params := cast( null as ut_annotations.tt_annotation_params);

l_ann_param := null;
l_ann_param.val := 'all.globaltests';
l_expected.package_annotations('suitepath').params(1) := l_ann_param;

check_annotation_parsing(l_expected, l_parsing_result);

if ut_expectation_processor.get_status = ut_utils.tr_success then
:test_result := ut_utils.tr_success;
end if;

end;
/
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,16 @@ set termout on

declare
l_objects_to_run ut_suite_items;
l_suite ut_suite;
begin
--act
l_objects_to_run := ut_suite_manager.configure_execution_by_path(ut_varchar2_list('tst_package_with$dollar'));

--Assert
ut.expect(l_objects_to_run.count).to_equal(1);

l_suite := treat(l_objects_to_run(1) as ut_suite);
ut.expect(l_suite.name).to_equal('tst_package_with$dollar');

if ut_expectation_processor.get_status = ut_utils.tr_success then
:test_result := ut_utils.tr_success;
Expand Down
7 changes: 7 additions & 0 deletions tests/ut_suite_manager/ut_suite_manager.PackageWithHash.sql
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,18 @@ set termout on

declare
l_objects_to_run ut_suite_items;
l_suite ut_suite;
begin

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

--Assert
ut.expect(l_objects_to_run.count).to_equal(1);

l_suite := treat(l_objects_to_run(1) as ut_suite);
ut.expect(l_suite.name).to_equal('tst_package_with#hash');

if ut_expectation_processor.get_status = ut_utils.tr_success then
:test_result := ut_utils.tr_success;
end if;
Expand Down
15 changes: 14 additions & 1 deletion tests/ut_suite_manager/ut_suite_manager.TestWithDollarSign.sql
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,30 @@ end;

create or replace package body tst_package_with_dollar_test as
procedure test$1 is begin ut.expect(1).to_equal(1); end;
procedure test$2 is begin ut.expect(1).to_equal(1); end;
end;
/

set termout on

declare
l_objects_to_run ut_suite_items;
l_suite ut_suite;
l_test ut_test;
begin
--act
l_objects_to_run := ut_suite_manager.configure_execution_by_path(ut_varchar2_list('tst_package_with_dollar_test.test$1'));

--Assert
ut.expect(l_objects_to_run.count).to_equal(1);

l_suite := treat(l_objects_to_run(1) as ut_suite);

ut.expect(l_suite.name).to_equal('tst_package_with_dollar_test');
ut.expect(l_suite.items.count).to_equal(1);

l_test := treat(l_suite.items(1) as ut_test);

ut.expect(l_test.name).to_equal('test$1');

if ut_expectation_processor.get_status = ut_utils.tr_success then
:test_result := ut_utils.tr_success;
Expand Down
15 changes: 14 additions & 1 deletion tests/ut_suite_manager/ut_suite_manager.TestWithHashSign.sql
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,31 @@ end;

create or replace package body tst_package_with_hash_test as
procedure test#1 is begin ut.expect(1).to_equal(1); end;
procedure test#2 is begin ut.expect(1).to_equal(1); end;
end;
/

set termout on

declare
l_objects_to_run ut_suite_items;
l_suite ut_suite;
l_test ut_test;
begin

--act
l_objects_to_run := ut_suite_manager.configure_execution_by_path(ut_varchar2_list('tst_package_with_hash_test.test#1'));

--Assert
ut.expect(l_objects_to_run.count).to_equal(1);

l_suite := treat(l_objects_to_run(1) as ut_suite);

ut.expect(l_suite.name).to_equal('tst_package_with_hash_test');
ut.expect(l_suite.items.count).to_equal(1);

l_test := treat(l_suite.items(1) as ut_test);

ut.expect(l_test.name).to_equal('test#1');

if ut_expectation_processor.get_status = ut_utils.tr_success then
:test_result := ut_utils.tr_success;
Expand Down
41 changes: 41 additions & 0 deletions tests/ut_suite_manager/ut_suite_manager.emptySuitePath.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
set termout off
create or replace package tst_empty_suite_path as
--%suite
--%suitepath

--%test
procedure test1;
end;
/

create or replace package body tst_empty_suite_path as
procedure test1 is begin ut.expect(1).to_equal(1); end;
end;
/

set termout on

declare
l_objects_to_run ut_suite_items;
l_suite ut_suite;
begin

--act
l_objects_to_run := ut_suite_manager.configure_execution_by_path(ut_varchar2_list('tst_empty_suite_path'));

--Assert
ut.expect(l_objects_to_run.count).to_equal(1);

l_suite := treat(l_objects_to_run(1) as ut_suite);

ut.expect(l_suite.name).to_equal('tst_empty_suite_path');

if ut_expectation_processor.get_status = ut_utils.tr_success then
:test_result := ut_utils.tr_success;
end if;

end;
/

drop package tst_empty_suite_path
/