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

Skip to content

Commit c7debe5

Browse files
authored
Merge branch 'version3' into feature/docframework
2 parents 9b8866d + 933900a commit c7debe5

32 files changed

Lines changed: 1119 additions & 434 deletions

File tree

examples/RunExampleTestAnnotationsHugePackage.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ set echo off
1010
declare
1111
l_suite ut_test_suite;
1212
begin
13-
ut_suite_manager.config_package(a_owner_name => USER,a_object_name => 'TST_PKG_HUGE',a_suite => l_suite);
13+
l_suite := ut_suite_manager.config_package(a_owner_name => USER,a_object_name => 'TST_PKG_HUGE');
1414
end;
1515
/
1616

source/install.sql

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1+
prompt Installing utplsql framework
2+
13
whenever sqlerror exit failure rollback
24
whenever oserror exit failure rollback
35

4-
prompt Installing utplsql framework
56
@@types/ut_object.tps
67
@@types/ut_objects_list.tps
78
@@types/ut_composite_object.tps
89
@@types/ut_executable.tps
910
@@types/ut_assert_result.tps
1011
@@types/ut_assert_list.tps
11-
@@ut_assert.pks
1212
@@types/ut_reporter.tps
1313
@@types/ut_reporters_list.tps
1414
@@types/ut_composite_reporter.tps
@@ -19,6 +19,8 @@ prompt Installing utplsql framework
1919
@@types/ut_dbms_output_suite_reporter.tps
2020
@@ut_utils.pks
2121
@@ut_metadata.pks
22+
@@ut_assert.pks
23+
@@ut_annotations.pks
2224
@@ut_suite_manager.pks
2325

2426
@@ut_utils.pkb
@@ -33,6 +35,7 @@ prompt Installing utplsql framework
3335
@@types/ut_reporter_decorator.tpb
3436
@@types/ut_dbms_output_suite_reporter.tpb
3537
@@ut_metadata.pkb
38+
@@ut_annotations.pkb
3639
@@ut_assert.pkb
3740
@@ut_suite_manager.pkb
3841

source/uninstall.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ drop package ut_suite_manager;
22

33
drop package ut_assert;
44

5+
drop package ut_annotations;
6+
57
drop package ut_metadata;
68

79
drop package ut_utils;

source/ut_annotations.pkb

Lines changed: 349 additions & 0 deletions
Large diffs are not rendered by default.

source/ut_annotations.pks

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
create or replace package ut_annotations as
2+
/*
3+
package: ut_annotations
4+
5+
Responsible for parsing and accessing utplsql annotations.
6+
7+
*/
8+
9+
subtype t_annotation_name is varchar2(1000);
10+
subtype t_procedure_name is varchar2(30);
11+
12+
/*
13+
type: typ_annotation_param
14+
15+
a key/value pair of annotation parameters
16+
17+
example:
18+
--%test(name=A name of the test)
19+
will be stored as:
20+
typ_annotation_param( key=> 'name', value=>'A name of the test' )
21+
*/
22+
type typ_annotation_param is record(
23+
key varchar2(255)
24+
,value varchar2(4000));
25+
26+
/*
27+
type: typ_annotation_param
28+
a list of typ_annotation_param
29+
*/
30+
type tt_annotation_params is table of typ_annotation_param index by pls_integer;
31+
32+
/*
33+
type: tt_annotations
34+
a list of tt_annotation_params index by the annotation name
35+
*/
36+
type tt_annotations is table of tt_annotation_params index by t_annotation_name;
37+
38+
/*
39+
type: tt_procedure_annotations
40+
a list of tt_annotations index by the procedure name
41+
*/
42+
type tt_procedure_annotations is table of tt_annotations index by t_procedure_name;
43+
44+
/*
45+
type: typ_annotated_package
46+
a structure containing a list of package level annotations and a list of procedure level annotations
47+
48+
*/
49+
type typ_annotated_package is record(
50+
procedure_annotations tt_procedure_annotations
51+
,package_annotations tt_annotations);
52+
53+
/*
54+
INTERNAL USE ONLY
55+
*/
56+
function parse_package_annotations(a_source clob) return typ_annotated_package;
57+
58+
/*
59+
function: get_package_annotations
60+
61+
get annotations for specified package specification and return its annotated schema
62+
*/
63+
function get_package_annotations(a_owner_name varchar2, a_name varchar2) return typ_annotated_package;
64+
65+
66+
/*
67+
function: get_annotation_param
68+
69+
get annotation parameter on a specified index position
70+
*/
71+
function get_annotation_param(a_param_list tt_annotation_params, a_def_index pls_integer) return varchar2;
72+
73+
end ut_annotations;
74+
/

source/ut_assert.pkb

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,37 @@ create or replace package body ut_assert is
145145
begin
146146
build_assert_result(a_condition, 'this', 'boolean', 'boolean', ut_utils.to_string(true), ut_utils.to_string(a_condition), ut_utils.to_string(a_msg));
147147
end;
148+
149+
-- Strings assertions
150+
procedure is_like(a_msg in varchar2, a_checking_string in varchar2, a_mask in varchar, a_escape_char in varchar2) is
151+
l_condition boolean;
152+
begin
153+
if a_escape_char is not null then
154+
l_condition := a_checking_string like a_mask escape a_escape_char;
155+
else
156+
l_condition := a_checking_string like a_mask;
157+
end if;
158+
build_assert_result(l_condition, 'is_like', 'varchar2', 'varchar2', ut_utils.to_string('like ' || a_mask), ut_utils.to_string(l_condition), a_msg);
159+
end;
160+
procedure is_like(a_msg in varchar2, a_checking_string in varchar2, a_mask in varchar) is
161+
begin
162+
is_like(a_msg, a_checking_string, a_mask, null);
163+
end;
164+
procedure is_like(a_checking_string in varchar2, a_mask in varchar2) is
165+
begin
166+
is_like(a_msg => null, a_checking_string => a_checking_string, a_mask => a_mask);
167+
end;
168+
169+
procedure is_matching(a_msg in varchar2, a_checking_string in varchar2, a_pattern in varchar2, a_modifier in varchar2 default null) is
170+
l_condition boolean := sys.standard.regexp_like(a_checking_string, a_pattern, a_modifier);
171+
begin
172+
build_assert_result(l_condition, 'is_matching', 'varchar2', 'varchar2', ut_utils.to_string('pattern ' || a_pattern), ut_utils.to_string(l_condition), a_msg);
173+
end;
174+
175+
procedure is_matching(a_checking_string in varchar2, a_pattern in varchar2, a_modifier in varchar2 default null) is
176+
begin
177+
is_matching(null, a_checking_string, a_pattern, a_modifier);
178+
end;
148179

149180
procedure is_null(a_actual in number) is
150181
begin

source/ut_assert.pks

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,36 @@ create or replace package ut_assert authid current_user as
55
procedure report_error(a_message in varchar2);
66
function get_asserts_results return ut_objects_list;
77

8-
/* Just need something to play with for now */
9-
procedure are_equal(a_expected in number, a_actual in number);
8+
-- General assertion
9+
procedure this(a_msg in varchar2, a_condition in boolean);
10+
procedure this(a_condition in boolean);
11+
12+
-- Equality assertions
1013
procedure are_equal(a_msg in varchar2, a_expected in number, a_actual in number);
14+
procedure are_equal(a_expected in number, a_actual in number);
1115

12-
procedure are_equal(a_expected in varchar2, a_actual in varchar2);
1316
procedure are_equal(a_msg in varchar2, a_expected in varchar2, a_actual in varchar2);
17+
procedure are_equal(a_expected in varchar2, a_actual in varchar2);
1418

15-
procedure are_equal(a_expected in date, a_actual in date);
1619
procedure are_equal(a_msg in varchar2, a_expected in date, a_actual in date);
20+
procedure are_equal(a_expected in date, a_actual in date);
1721

18-
procedure are_equal(a_expected in timestamp_unconstrained, a_actual in timestamp_unconstrained);
1922
procedure are_equal(a_msg in varchar2, a_expected in timestamp_unconstrained, a_actual in timestamp_unconstrained);
23+
procedure are_equal(a_expected in timestamp_unconstrained, a_actual in timestamp_unconstrained);
2024

21-
procedure are_equal(a_expected in anydata, a_actual in anydata);
2225
procedure are_equal(a_msg in varchar2, a_expected in anydata, a_actual in anydata);
26+
procedure are_equal(a_expected in anydata, a_actual in anydata);
2327

24-
procedure are_equal(a_expected in sys_refcursor, a_actual in sys_refcursor);
2528
procedure are_equal(a_msg in varchar2, a_expected in sys_refcursor, a_actual in sys_refcursor);
29+
procedure are_equal(a_expected in sys_refcursor, a_actual in sys_refcursor);
2630

27-
procedure this(a_condition in boolean);
28-
procedure this(a_msg in varchar2, a_condition in boolean);
31+
-- Pattern matching assertions
32+
procedure is_like(a_msg in varchar2, a_checking_string in varchar2, a_mask in varchar, a_escape_char in varchar2);
33+
procedure is_like(a_msg in varchar2, a_checking_string in varchar2, a_mask in varchar);
34+
procedure is_like(a_checking_string in varchar2, a_mask in varchar2);
35+
36+
procedure is_matching(a_msg in varchar2, a_checking_string in varchar2,a_pattern in varchar2, a_modifier in varchar2 default null);
37+
procedure is_matching(a_checking_string in varchar2,a_pattern in varchar2, a_modifier in varchar2 default null);
2938

3039
procedure is_null(a_actual in number);
3140
procedure is_null(a_msg in varchar2, a_actual in number);

0 commit comments

Comments
 (0)