Skip to content

Commit cf49d75

Browse files
committed
fixing $ and # sign in user and procedures
fixed dollar escape in skip_by_path method changed ut3_user to ut3$user# (escaped variable in travis)
1 parent f439b3d commit cf49d75

13 files changed

+159
-27
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ env:
2222
global:
2323
- UT3_OWNER=ut3
2424
- UT3_OWNER_PASSWORD=ut3
25-
- UT3_USER=ut3_user
25+
- UT3_USER="UT3\$USER#"
2626
- UT3_USER_PASSWORD=ut3
2727
- UT3_TABLESPACE=users
2828
# Environment for building a release

source/core/coverage/ut_coverage.pkb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ create or replace package body ut_coverage is
5050
(select min(t.line) - 1
5151
from all_source t
5252
where t.owner = s.owner and t.type = s.type and t.name = s.name
53-
and regexp_like( t.text, '\w*(begin|declare|compound).*','i'))
53+
and regexp_like( t.text, '[A-Za-z0-9$#_]*(begin|declare|compound).*','i'))
5454
) as line,
5555
s.text,
5656
case

source/core/types/ut_run.tpb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,16 +111,16 @@ create or replace type body ut_run as
111111
l_schemes := ut_varchar2_list();
112112
for i in 1 .. self.run_paths.count loop
113113
l_path := self.run_paths(i);
114-
if regexp_like(l_path, '^(\w+)?:') then
115-
l_schema := regexp_substr(l_path, '^(\w+)?:',subexpression => 1);
114+
if regexp_like(l_path, '^([A-Za-z0-9$#_]+)?:') then
115+
l_schema := regexp_substr(l_path, '^([A-Za-z0-9$#_]+)?:',subexpression => 1);
116116
if l_schema is not null then
117117
l_schema := sys.dbms_assert.schema_name(upper(l_schema));
118118
else
119119
l_schema := c_current_schema;
120120
end if;
121121
else
122122
begin
123-
l_schema := sys.dbms_assert.schema_name(upper(regexp_substr(l_path, '^\w+')));
123+
l_schema := sys.dbms_assert.schema_name(upper(regexp_substr(l_path, '^[A-Za-z0-9$#_]+')));
124124
exception
125125
when sys.dbms_assert.invalid_schema_name then
126126
l_schema := c_current_schema;

source/core/ut_expectation_processor.pkb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,14 +129,14 @@ create or replace package body ut_expectation_processor as
129129
l_object_name varchar2(1000);
130130
-- in 12.2 format_call_stack reportes not only package name, but also the procedure name
131131
-- when 11g and 12c reports only package name
132-
c_expectation_search_pattern constant varchar2(500) := '(.*\.UT_EXPECTATION_RESULT\s+)(.*\.UT_EXPECTATION[A-Z0-9#_$]*(\.\w+)?.*\s+)+(.*)\s';
132+
c_expectation_search_pattern constant varchar2(500) := '(.*\.UT_EXPECTATION_RESULT\s+)(.*\.UT_EXPECTATION[A-Z0-9#_$]*(\.[A-Za-z0-9$#_]+)?.*\s+)+(.*)\s';
133133
begin
134134
l_caller_stack_line := regexp_substr( c_call_stack, c_expectation_search_pattern, 1, 1, 'm', 4);
135135
l_line_no := to_number( regexp_substr(l_caller_stack_line,'^\dx[0-9a-f]+\s+(\d+)',subexpression => 1) );
136136
l_caller_type_and_name := substr( l_caller_stack_line, 23 );
137137
if l_caller_stack_line like '%.%' then
138-
l_owner := regexp_substr(l_caller_stack_line,'\s(\w+)\.(\w|\.)+$',subexpression => 1);
139-
l_object_name := regexp_substr(l_caller_stack_line,'\s(\w+)\.((\w|\.)+)$',subexpression => 2);
138+
l_owner := regexp_substr(l_caller_stack_line,'\s([A-Za-z0-9$#_]+)\.([A-Za-z0-9$#_]|\.)+$',subexpression => 1);
139+
l_object_name := regexp_substr(l_caller_stack_line,'\s([A-Za-z0-9$#_]+)\.(([A-Za-z0-9$#_]|\.)+)$',subexpression => 2);
140140
end if;
141141
return
142142
case when l_owner is not null and l_object_name is not null and l_line_no is not null then

source/core/ut_suite_manager.pkb

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,7 @@ create or replace package body ut_suite_manager is
379379
else
380380
for i in 1 .. a_paths.count loop
381381
l_path := a_paths(i);
382-
if l_path is null or not (regexp_like(l_path, '^\w+(\.\w+){0,2}$') or regexp_like(l_path, '^(\w+)?:\w+(\.\w+)*$')) then
382+
if l_path is null or not (regexp_like(l_path, '^[A-Za-z0-9$#_]+(\.[A-Za-z0-9$#_]+){0,2}$') or regexp_like(l_path, '^([A-Za-z0-9$#_]+)?:[A-Za-z0-9$#_]+(\.[A-Za-z0-9$#_]+)*$')) then
383383
raise_application_error(ut_utils.gc_invalid_path_format, 'Invalid path format: ' || nvl(l_path, 'NULL'));
384384
end if;
385385
end loop;
@@ -410,7 +410,7 @@ create or replace package body ut_suite_manager is
410410
end clean_paths;
411411

412412
procedure skip_by_path(a_suite in out nocopy ut_suite_item, a_path varchar2) is
413-
c_root constant varchar2(32767) := regexp_substr(a_path, '\w+');
413+
c_root constant varchar2(32767) := replace(regexp_substr(a_path, '[A-Za-z0-9$#_]+'), '$', '\$');
414414
c_rest_path constant varchar2(32767) := regexp_substr(a_path, '\.(.+)', subexpression => 1);
415415
l_suite ut_logical_suite;
416416
l_item ut_suite_item;
@@ -428,7 +428,7 @@ create or replace package body ut_suite_manager is
428428
l_item := l_suite.items(i);
429429

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

434434
skip_by_path(l_item, c_rest_path);
@@ -473,8 +473,8 @@ create or replace package body ut_suite_manager is
473473
for i in 1 .. l_paths.count loop
474474
l_path := l_paths(i);
475475

476-
if regexp_like(l_path, '^(\w+)?:') then
477-
l_schema := regexp_substr(l_path, '^(\w+)?:',subexpression => 1);
476+
if regexp_like(l_path, '^([A-Za-z0-9$#_]+)?:') then
477+
l_schema := regexp_substr(l_path, '^([A-Za-z0-9$#_]+)?:',subexpression => 1);
478478
-- transform ":path1[.path2]" to "schema:path1[.path2]"
479479
if l_schema is not null then
480480
l_schema := sys.dbms_assert.schema_name(upper(l_schema));
@@ -486,7 +486,7 @@ create or replace package body ut_suite_manager is
486486
-- When path is one of: schema or schema.package[.object] or package[.object]
487487
-- transform it back to schema[.package[.object]]
488488
begin
489-
l_schema := regexp_substr(l_path, '^\w+');
489+
l_schema := regexp_substr(l_path, '^[A-Za-z0-9$#_]+');
490490
l_schema := sys.dbms_assert.schema_name(upper(l_schema));
491491
exception
492492
when sys.dbms_assert.invalid_schema_name then
@@ -502,7 +502,7 @@ create or replace package body ut_suite_manager is
502502

503503
l_schema_suites := get_schema_suites(upper(l_schema));
504504

505-
if regexp_like(l_path, '^\w+$') then
505+
if regexp_like(l_path, '^[A-Za-z0-9$#_]+$') then
506506
-- run whole schema
507507
l_index := l_schema_suites.first;
508508
while l_index is not null loop
@@ -512,14 +512,14 @@ create or replace package body ut_suite_manager is
512512
end loop;
513513
else
514514
-- convert SCHEMA.PACKAGE.PROCEDURE syntax to fully qualified path
515-
if regexp_like(l_path, '^\w+(\.\w+){1,2}$') then
515+
if regexp_like(l_path, '^[A-Za-z0-9$#_]+(\.[A-Za-z0-9$#_]+){1,2}$') then
516516
declare
517517
l_temp_suite ut_logical_suite;
518518
l_package_name varchar2(4000);
519519
l_procedure_name varchar2(4000);
520520
begin
521-
l_package_name := regexp_substr(l_path, '^\w+\.(\w+)(\.(\w+))?$', subexpression => 1);
522-
l_procedure_name := regexp_substr(l_path, '^\w+\.(\w+)(\.(\w+))?$', subexpression => 3);
521+
l_package_name := regexp_substr(l_path, '^[A-Za-z0-9$#_]+\.([A-Za-z0-9$#_]+)(\.([A-Za-z0-9$#_]+))?$', subexpression => 1);
522+
l_procedure_name := regexp_substr(l_path, '^[A-Za-z0-9$#_]+\.([A-Za-z0-9$#_]+)(\.([A-Za-z0-9$#_]+))?$', subexpression => 3);
523523

524524
l_temp_suite := config_package(l_schema, l_package_name);
525525

@@ -535,7 +535,7 @@ create or replace package body ut_suite_manager is
535535
-- by this time it's the only format left
536536
-- schema:suite.suite.suite
537537
l_suite_path := regexp_substr(l_path, ':(.+)', subexpression => 1);
538-
l_root_suite_name := regexp_substr(l_suite_path, '^\w+');
538+
l_root_suite_name := regexp_substr(l_suite_path, '^[A-Za-z0-9$#_]+');
539539

540540
begin
541541
l_suite := l_schema_suites(l_root_suite_name);

tests/RunAll.sql

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,10 @@ exec ut_coverage.coverage_start_develop();
177177
@@lib/RunTest.sql ut_suite_manager/ut_suite_manager.DoesntFindTheSuiteWhenPackageSpecIsInvalid.sql
178178
@@lib/RunTest.sql ut_suite_manager/ut_suite_manager.IncludesInvalidPackageBodiesInTheRun.sql
179179
@@lib/RunTest.sql ut_suite_manager/ut_suite_manager.CacheInvalidaesOnPackageDrop.sql
180+
@@lib/RunTest.sql ut_suite_manager/ut_suite_manager.PackageWithDollarSign.sql
181+
@@lib/RunTest.sql ut_suite_manager/ut_suite_manager.TestWithDollarSign.sql
182+
@@lib/RunTest.sql ut_suite_manager/ut_suite_manager.PackageWithHash.sql
183+
@@lib/RunTest.sql ut_suite_manager/ut_suite_manager.TestWithHashSign.sql
180184

181185

182186
@@lib/RunTest.sql ut_test/ut_test.DisabledFlagSkipTest.sql

tests/helpers/html_coverage_test.pck

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
CREATE OR REPLACE PACKAGE ut3_user.html_coverage_test IS
1+
CREATE OR REPLACE PACKAGE ut3$user#.html_coverage_test IS
22

33
-- Author : LUW07
44
-- Created : 23/05/2017 09:37:29
@@ -8,7 +8,7 @@ CREATE OR REPLACE PACKAGE ut3_user.html_coverage_test IS
88
PROCEDURE run_if_statment(o_result OUT NUMBER);
99
END HTML_COVERAGE_TEST;
1010
/
11-
CREATE OR REPLACE PACKAGE BODY ut3_user.html_coverage_test IS
11+
CREATE OR REPLACE PACKAGE BODY ut3$user#.html_coverage_test IS
1212

1313
-- Private type declarations
1414
PROCEDURE run_if_statment(o_result OUT NUMBER) IS
@@ -22,4 +22,4 @@ CREATE OR REPLACE PACKAGE BODY ut3_user.html_coverage_test IS
2222
o_result := l_success;
2323
END run_if_statment;
2424
END HTML_COVERAGE_TEST;
25-
/
25+
/

tests/helpers/test_reporters_1.pkb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ as
44
is
55
l_result number;
66
begin
7-
ut3_user.html_coverage_test.run_if_statment(l_result);
7+
ut3$user#.html_coverage_test.run_if_statment(l_result);
88
ut.expect(l_result).to_equal(1);
99
end;
1010
end;
1111
/
12-

tests/ut_reporters/ut_html_reporter.UserOverrideSchemaCoverage.sql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ DECLARE
33
l_clob CLOB;
44
l_expected VARCHAR2(32767);
55
BEGIN
6-
l_expected := '%<h3>UT3_USER.HTML_COVERAGE_TEST</h3>%';
6+
l_expected := '%<h3>UT3$USER#.HTML_COVERAGE_TEST</h3>%';
77
SELECT * BULK COLLECT
88
INTO l_results
99
FROM TABLE(ut.run('test_reporters_1', ut_coverage_html_reporter(),
10-
a_coverage_schemes => ut_varchar2_list('ut3_user')));
10+
a_coverage_schemes => ut_varchar2_list('ut3$user#')));
1111
l_clob := ut3.ut_utils.table_to_clob(l_results);
1212

1313
IF l_clob LIKE l_expected THEN
@@ -17,4 +17,4 @@ BEGIN
1717
END IF;
1818

1919
END;
20-
/
20+
/
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
set termout off
2+
create or replace package tst_package_with$dollar as
3+
--%suite
4+
5+
--%test
6+
procedure test1;
7+
end;
8+
/
9+
10+
create or replace package body tst_package_with$dollar as
11+
procedure test1 is begin ut.expect(1).to_equal(1); end;
12+
procedure test2 is begin ut.expect(1).to_equal(1); end;
13+
end;
14+
/
15+
16+
set termout on
17+
18+
declare
19+
l_objects_to_run ut_suite_items;
20+
begin
21+
--act
22+
l_objects_to_run := ut_suite_manager.configure_execution_by_path(ut_varchar2_list('tst_package_with$dollar'));
23+
24+
if ut_expectation_processor.get_status = ut_utils.tr_success then
25+
:test_result := ut_utils.tr_success;
26+
end if;
27+
end;
28+
/
29+
30+
drop package tst_package_with$dollar
31+
/

0 commit comments

Comments
 (0)