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

Skip to content

Commit bfde057

Browse files
committed
Add function to check whether a given name is a valid output reporter
1 parent 202e697 commit bfde057

2 files changed

Lines changed: 27 additions & 0 deletions

File tree

source/api/ut_runner.pkb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,5 +141,22 @@ create or replace package body ut_runner is
141141
return;
142142
end;
143143

144+
function is_output_reporter( a_reporter_name varchar2 ) return varchar is
145+
l_result varchar2(1);
146+
l_reporter_name varchar2(32) := regexp_replace(a_reporter_name, '[^a-zA-Z0-9_]', '');
147+
l_owner varchar2(128) := ut_utils.ut_owner();
148+
begin
149+
execute immediate '
150+
select
151+
case
152+
when '||l_reporter_name||'() is of ('||l_owner||'.ut_output_reporter_base) then ''Y''
153+
when '||l_reporter_name||'() is of ('||l_owner||'.ut_reporter_base) then ''N''
154+
end
155+
from dual' into l_result;
156+
return l_result;
157+
exception when others then
158+
return null;
159+
end;
160+
144161
end ut_runner;
145162
/

source/api/ut_runner.pks

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,16 @@ create or replace package ut_runner authid current_user is
9999
*/
100100
function get_unit_test_info(a_owner varchar2, a_package_name varchar2 := null) return tt_annotations pipelined;
101101

102+
/** Checks whether a reporter is an output reporter or not
103+
* If reporter is of ut_output_reporter_base, returns 'Y'
104+
* If reporter is of ut_reporter_base, returns 'N'
105+
* Otherwise returns NULL
106+
*
107+
* @param a_reporter_name Name of the reporter to check
108+
* @return Y, N or NULL
109+
*/
110+
function is_output_reporter( a_reporter_name varchar2 ) return varchar;
111+
102112

103113
end ut_runner;
104114
/

0 commit comments

Comments
 (0)