Skip to content

Commit 895fc90

Browse files
committed
Updated submodule to point to master repo for any_data.
Added grants for dbms_crypto (required by any_data MD5 calculation). Added is_null and is_not_null assertions. Updated test for any_data to_string outcomes. Updated CONTRIBUTING.md to include instruction for submodule update.
1 parent c51f87e commit 895fc90

15 files changed

+237
-5
lines changed

.gitmodules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[submodule "any_data"]
22
path = lib/any_data
33
url = https://github.com/jgebal/any_data.git
4-
branch = 1.0.4
4+
branch = master

.travis/create_utplsql_user.sql

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,6 @@ create user &ut3_user identified by &ut3_password default tablespace &ut3_tables
1313

1414
grant create session, create procedure, create type, create table to &ut3_user;
1515

16+
grant execute on sys.dbms_crypto to &ut3_user;
17+
1618
exit success

CONTRIBUTING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Changes are welcome from all members of the Community.
1010
* Each of the steps below are detailed in the [How to Fork](https://help.github.com/articles/fork-a-repo) article!
1111
* Clone your Fork to your local machine.
1212
* Configure "upstream" remote to the [master utPLSQL repository](https://github.com/utPLSQL/utPLSQL.git).
13+
* Update the git submodules by issuing command: [git submodule update --remote --merge](http://stackoverflow.com/a/21195182)
1314
3. For each change you want to make:
1415
* Create a new branch for your change.
1516
* Make your change in your new branch.

lib/any_data

Submodule any_data updated 37 files

source/ut_assert.pkb

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,5 +146,116 @@ create or replace package body ut_assert is
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;
148148

149+
procedure is_null(a_actual in number) is
150+
begin
151+
is_null(null, a_actual);
152+
end;
153+
154+
procedure is_null(a_msg in varchar2, a_actual in number) is
155+
begin
156+
build_assert_result((a_actual is null), 'is_null', 'number', 'number', 'NULL', ut_utils.to_string(a_actual), ut_utils.to_string(a_msg));
157+
end;
158+
159+
procedure is_null(a_actual in varchar2) is
160+
begin
161+
is_null(null, a_actual);
162+
end;
163+
164+
procedure is_null(a_msg in varchar2, a_actual in varchar2) is
165+
begin
166+
build_assert_result((a_actual is null), 'is_null', 'varchar2', 'varchar2', 'NULL', ut_utils.to_string(a_actual), ut_utils.to_string(a_msg));
167+
end;
168+
169+
170+
procedure is_null(a_actual in date) is
171+
begin
172+
is_null(null, a_actual);
173+
end;
174+
175+
176+
procedure is_null(a_msg in varchar2, a_actual in date) is
177+
begin
178+
build_assert_result((a_actual is null), 'is_null', 'date', 'date', 'NULL', ut_utils.to_string(a_actual), ut_utils.to_string(a_msg));
179+
end;
180+
181+
182+
procedure is_null(a_actual in timestamp_unconstrained) is
183+
begin
184+
is_null(null, a_actual);
185+
end;
186+
187+
188+
procedure is_null(a_msg in varchar2, a_actual in timestamp_unconstrained) is
189+
begin
190+
build_assert_result((a_actual is null), 'is_null', 'timestamp', 'timestamp', 'NULL', ut_utils.to_string(a_actual), ut_utils.to_string(a_msg));
191+
end;
192+
193+
194+
procedure is_null(a_actual in anydata) is
195+
begin
196+
is_null(null, a_actual);
197+
end;
198+
199+
200+
procedure is_null(a_msg in varchar2, a_actual in anydata) is
201+
l_actual any_data;
202+
begin
203+
l_actual := any_data_builder.build(a_actual);
204+
build_assert_result( l_actual.is_null(), 'is_null', l_actual.type_name, l_actual.type_name, 'NULL', ut_utils.to_string(l_actual.to_string()), ut_utils.to_string(a_msg));
205+
end;
206+
207+
procedure is_not_null(a_actual in number) is
208+
begin
209+
is_not_null(null, a_actual);
210+
end;
211+
212+
procedure is_not_null(a_msg in varchar2, a_actual in number) is
213+
begin
214+
build_assert_result((a_actual is not null), 'is_not_null', 'number', 'number', 'NOT NULL', ut_utils.to_string(a_actual), ut_utils.to_string(a_msg));
215+
end;
216+
217+
procedure is_not_null(a_actual in varchar2) is
218+
begin
219+
is_not_null(null, a_actual);
220+
end;
221+
222+
procedure is_not_null(a_msg in varchar2, a_actual in varchar2) is
223+
begin
224+
build_assert_result((a_actual is not null), 'is_not_null', 'varchar2', 'varchar2', 'NOT NULL', ut_utils.to_string(a_actual), ut_utils.to_string(a_msg));
225+
end;
226+
227+
procedure is_not_null(a_actual in date) is
228+
begin
229+
is_not_null(null, a_actual);
230+
end;
231+
232+
procedure is_not_null(a_msg in varchar2, a_actual in date) is
233+
begin
234+
build_assert_result((a_actual is not null), 'is_not_null', 'date', 'date', 'NOT NULL', ut_utils.to_string(a_actual), ut_utils.to_string(a_msg));
235+
end;
236+
237+
procedure is_not_null(a_actual in timestamp_unconstrained) is
238+
begin
239+
is_not_null(null, a_actual);
240+
end;
241+
242+
procedure is_not_null(a_msg in varchar2, a_actual in timestamp_unconstrained) is
243+
begin
244+
build_assert_result((a_actual is not null), 'is_not_null', 'timestamp', 'timestamp', 'NOT NULL', ut_utils.to_string(a_actual), ut_utils.to_string(a_msg));
245+
end;
246+
247+
procedure is_not_null(a_actual in anydata) is
248+
begin
249+
is_not_null(null, a_actual);
250+
end;
251+
252+
procedure is_not_null(a_msg in varchar2, a_actual in anydata) is
253+
l_actual any_data;
254+
begin
255+
l_actual := any_data_builder.build(a_actual);
256+
build_assert_result( not l_actual.is_null(), 'is_not_null', l_actual.type_name, l_actual.type_name, 'NOT NULL', ut_utils.to_string(l_actual.to_string()), ut_utils.to_string(a_msg));
257+
end;
258+
259+
149260
end ut_assert;
150261
/

source/ut_assert.pks

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,35 @@ create or replace package ut_assert authid current_user as
2727
procedure this(a_condition in boolean);
2828
procedure this(a_msg in varchar2, a_condition in boolean);
2929

30+
procedure is_null(a_actual in number);
31+
procedure is_null(a_msg in varchar2, a_actual in number);
32+
33+
procedure is_null(a_actual in varchar2);
34+
procedure is_null(a_msg in varchar2, a_actual in varchar2);
35+
36+
procedure is_null(a_actual in date);
37+
procedure is_null(a_msg in varchar2, a_actual in date);
38+
39+
procedure is_null(a_actual in timestamp_unconstrained);
40+
procedure is_null(a_msg in varchar2, a_actual in timestamp_unconstrained);
41+
42+
procedure is_null(a_actual in anydata);
43+
procedure is_null(a_msg in varchar2, a_actual in anydata);
44+
45+
procedure is_not_null(a_actual in number);
46+
procedure is_not_null(a_msg in varchar2, a_actual in number);
47+
48+
procedure is_not_null(a_actual in varchar2);
49+
procedure is_not_null(a_msg in varchar2, a_actual in varchar2);
50+
51+
procedure is_not_null(a_actual in date);
52+
procedure is_not_null(a_msg in varchar2, a_actual in date);
53+
54+
procedure is_not_null(a_actual in timestamp_unconstrained);
55+
procedure is_not_null(a_msg in varchar2, a_actual in timestamp_unconstrained);
56+
57+
procedure is_not_null(a_actual in anydata);
58+
procedure is_not_null(a_msg in varchar2, a_actual in anydata);
59+
3060
end ut_assert;
3161
/

tests/RunAll.sql

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,15 @@ set serveroutput on size unlimited format truncated
7171

7272
@@lib/RunTest.sql ut_assert/ut_assert.are_equal.scalar.FailsToExecuteWhenNullsPassedAsParameters.sql
7373

74+
@@lib/RunTest.sql ut_assert/ut_assert.is_not_null.date.GivesFailureForNullValue.sql
75+
@@lib/RunTest.sql ut_assert/ut_assert.is_not_null.date.GivesSuccessForNotNullValue.sql
76+
77+
@@lib/RunTest.sql ut_assert/ut_assert.is_null.anydata.GivesFailureWhenDataIsNotNull.sql
78+
@@lib/RunTest.sql ut_assert/ut_assert.is_null.anydata.GivesSuccessWhenDataIsNull.sql
79+
80+
@@lib/RunTest.sql ut_assert/ut_assert.is_null.date.GivesFailureForNotNullValue.sql
81+
@@lib/RunTest.sql ut_assert/ut_assert.is_null.date.GivesSuccessForNullValue.sql
82+
7483
@@lib/RunTest.sql ut_utils/ut_utils.to_string.verySmallNumber.sql
7584
@@lib/RunTest.sql ut_utils/ut_utils.to_string.veryBigNumber.sql
7685
@@lib/RunTest.sql ut_utils/ut_utils.to_string.Date.sql
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
--Arrange
2+
declare
3+
l_actual &&1 := &&2;
4+
l_result integer;
5+
begin
6+
--Act
7+
ut_assert.&&3(l_actual);
8+
l_result := ut_assert.get_aggregate_asserts_result();
9+
--Assert
10+
if l_result = &&4 then
11+
:test_result := ut_utils.tr_success;
12+
else
13+
dbms_output.put_line('expected: '''||&&4||''', got: '''||l_result||'''' );
14+
end if;
15+
end;
16+
/

tests/ut_assert/ut_assert.are_equal.anydata.PutsObjectStrucureIntoAssert.sql

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@ begin
1717
l_assert_result := treat(ut_assert.get_asserts_results()(1) as ut_assert_result);
1818

1919
--Assert
20-
if l_assert_result.expected_value_string like q'[%department(%dept_name => 'HR'%)%]'
21-
and l_assert_result.actual_value_string like q'[%department(%dept_name => 'IT'%)%]'
20+
if l_assert_result.expected_value_string like q'[%DEPARTMENT(%dept_name => 'HR'%)%]'
21+
and l_assert_result.actual_value_string like q'[%DEPARTMENT(%dept_name => 'IT'%)%]'
2222
then
2323
:test_result := ut_utils.tr_success;
2424
else
25-
dbms_output.put_line( 'assert_result.message does not contain the objects' );
25+
dbms_output.put_line( l_assert_result.expected_value_string );
26+
dbms_output.put_line( l_assert_result.actual_value_string );
2627
end if;
2728
end;
2829
/
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
PROMPT Gives a failure when date value is null
2+
3+
@@ut_assert/common/ut_assert.null.scalar.common.sql 'date' 'null' 'is_not_null' 'ut_utils.tr_failure'

0 commit comments

Comments
 (0)