Skip to content

Fixed bug with similar suitepaths #469

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 28, 2017
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
8 changes: 2 additions & 6 deletions source/core/ut_suite_manager.pkb
Original file line number Diff line number Diff line change
Expand Up @@ -424,13 +424,11 @@ create or replace package body ut_suite_manager is
end clean_paths;

procedure skip_by_path(a_suite in out nocopy ut_suite_item, a_path varchar2) is
c_root constant varchar2(32767) := replace(regexp_substr(a_path, '[A-Za-z0-9$#_]+'), '$', '\$');
c_root constant varchar2(32767) := upper(regexp_substr(a_path, '[A-Za-z0-9$#_]+'));
c_rest_path constant varchar2(32767) := regexp_substr(a_path, '\.(.+)', subexpression => 1);
l_suite ut_logical_suite;
l_item ut_suite_item;
l_items ut_suite_items := ut_suite_items();
l_item_name varchar2(32767);

begin
if a_path is not null and a_suite is not null and a_suite is of (ut_logical_suite) then
l_suite := treat(a_suite as ut_logical_suite);
Expand All @@ -439,9 +437,7 @@ create or replace package body ut_suite_manager is

l_item := l_suite.items(i);

l_item_name := l_item.name;
--l_item_name := regexp_substr(l_item_name,'[A-Za-z0-9$#_]+$'); -- temporary fix. seems like suite have suitepath in object_name
if regexp_like(l_item_name, c_root, modifier => 'i') then
if upper(l_item.name) = c_root then

skip_by_path(l_item, c_rest_path);
l_items.extend;
Expand Down
56 changes: 56 additions & 0 deletions test/ut_suite_manager/test_suite_manager.pkb
Original file line number Diff line number Diff line change
Expand Up @@ -1208,5 +1208,61 @@ end test_package_3;]';
execute immediate 'drop package test_package_3';
end;

procedure test_pck_with_same_path is
l_objects_to_run ut3.ut_suite_items;
l_suite1 ut3.ut_logical_suite;
l_suite2 ut3.ut_logical_suite;
l_suite3 ut3.ut_suite;
begin
l_objects_to_run := ut3.ut_suite_manager.configure_execution_by_path(ut3.ut_varchar2_list(':test1.test2$.test_package_same_1'));

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

l_suite1 := treat(l_objects_to_run(1) as ut3.ut_logical_suite);
ut.expect(l_suite1.name).to_equal('test1');
ut.expect(l_suite1.items.count).to_equal(1);

l_suite2 := treat(l_suite1.items(1) as ut3.ut_logical_suite);
ut.expect(l_suite2.name).to_equal('test2$');
ut.expect(l_suite2.items.count).to_equal(1);

l_suite3 := treat(l_suite2.items(1) as ut3.ut_suite);
ut.expect(l_suite3.name).to_equal('test_package_same_1');
end;

procedure setup_pck_with_same_path is
pragma autonomous_transaction;
begin
execute immediate 'create or replace package test_package_same_1 as
--%suite
--%suitepath(test1.test2$)

--%test
procedure test1;
end;';
execute immediate 'create or replace package body test_package_same_1 as
procedure test1 is begin null; end;
end;';
execute immediate 'create or replace package test_package_same_1_a as
--%suite
--%suitepath(test1.test2$)

--%test
procedure test1;
end;';
execute immediate 'create or replace package body test_package_same_1_a as
procedure test1 is begin null; end;
end;';
end;

procedure clean_pck_with_same_path is
pragma autonomous_transaction;
begin
execute immediate 'drop package test_package_same_1';
execute immediate 'drop package test_package_same_1_a';
null;
end;

end test_suite_manager;
/
7 changes: 7 additions & 0 deletions test/ut_suite_manager/test_suite_manager.pks
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,13 @@ create or replace package test_suite_manager is
--%test
--%disabled
--procedure IncludesPackagesWithSutePath;

--%test(only the defined in suitepath suite/test is executed if multiple similarly named test suites exist in the context differed only by comment)
--%beforetest(setup_pck_with_same_path)
--%aftertest(clean_pck_with_same_path)
procedure test_pck_with_same_path;
procedure setup_pck_with_same_path;
procedure clean_pck_with_same_path;

end test_suite_manager;
/