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

Skip to content

Commit 7106a0e

Browse files
committed
Fixing PR comments.
1 parent 791c56e commit 7106a0e

2 files changed

Lines changed: 45 additions & 7 deletions

File tree

docs/userguide/advanced_data_comparison.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,44 @@ end;
126126

127127
```
128128

129+
Example of `include / exclude` for anydata.convertCollection
130+
131+
```plsql
132+
create or replace package ut_anydata_inc_exc IS
133+
134+
--%suite(Anydata)
135+
136+
--%test(Anydata include and exclude)
137+
procedure ut_anydata_test;
138+
139+
end ut_anydata_inc_exc;
140+
/
141+
142+
create or replace package body ut_anydata_inc_exc IS
143+
144+
procedure ut_refcursors1 IS
145+
l_actual ut3_tester_helper.test_dummy_object_list;
146+
l_expected ut3_tester_helper.test_dummy_object_list;
147+
begin
148+
--Arrange
149+
select ut3_tester_helper.test_dummy_object( rownum, 'Something Name'||rownum, rownum)
150+
bulk collect into l_actual
151+
from dual connect by level <=2;
152+
select ut3_tester_helper.test_dummy_object( rownum, 'Something '||rownum, rownum)
153+
bulk collect into l_expected
154+
from dual connect by level <=2
155+
order by rownum desc;
156+
--Act
157+
ut3.ut.expect(anydata.convertCollection(l_actual)).to_equal(anydata.convertCollection(l_expected)).include('ID');
158+
ut3.ut.expect(anydata.convertCollection(l_actual)).to_equal(anydata.convertCollection(l_expected)).exclude('name');
159+
end;
160+
161+
end ut_sample_test;
162+
/
163+
```
164+
165+
166+
129167
Only the columns 'RN', "A_Column" will be compared. Column 'SOME_COL' is excluded.
130168

131169
This option can be useful in scenarios where you need to narrow-down the scope of test so that the test is only focused on very specific data.

source/expectations/data_values/ut_cursor_details.tpb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,10 @@ create or replace type body ut_cursor_details as
146146

147147
member function get_missing_join_by_columns( a_expected_columns ut_varchar2_list ) return ut_varchar2_list is
148148
l_result ut_varchar2_list;
149-
l_prefix varchar2(125);
149+
l_root varchar2(125);
150150
begin
151151
if self.is_anydata = 1 then
152-
l_prefix := get_root;
152+
l_root := get_root;
153153
end if;
154154
--regexp_replace(c.access_path,'^\/?([^\/]+\/){1}')
155155
select fl.column_value
@@ -160,7 +160,7 @@ create or replace type body ut_cursor_details as
160160
where regexp_like(c.access_path,'^/?'||
161161
case
162162
when self.is_anydata = 1 then
163-
l_prefix||'/'||trim (leading '/' from fl.column_value)
163+
l_root||'/'||trim (leading '/' from fl.column_value)
164164
else
165165
fl.column_value
166166
end||'($|/.*)'
@@ -174,13 +174,13 @@ create or replace type body ut_cursor_details as
174174
l_result ut_cursor_details := self;
175175
l_column_tab ut_cursor_column_tab := ut_cursor_column_tab();
176176
l_column ut_cursor_column;
177-
l_prefix varchar2(125);
177+
l_root varchar2(125);
178178
c_xpath_extract_reg constant varchar2(50) := '^((/ROW/)|^(//)|^(/\*/))?(.*)';
179179
begin
180180
if l_result.cursor_columns_info is not null then
181181

182182
if self.is_anydata = 1 then
183-
l_prefix := get_root;
183+
l_root := get_root;
184184
end if;
185185

186186
--limit columns to those on the include items minus exclude items
@@ -201,7 +201,7 @@ create or replace type body ut_cursor_details as
201201
select 1 from included_columns f where regexp_like(x.access_path,'^/?'||
202202
case
203203
when self.is_anydata = 1 then
204-
l_prefix||'/'||trim(leading '/' from f.col_names)
204+
l_root||'/'||trim(leading '/' from f.col_names)
205205
else
206206
f.col_names
207207
end||'($|/.*)'
@@ -221,7 +221,7 @@ create or replace type body ut_cursor_details as
221221
select 1 from excluded_columns f where regexp_like(x.access_path,'^/?'||
222222
case
223223
when self.is_anydata = 1 then
224-
l_prefix||'/'||trim(leading '/' from f.col_names)
224+
l_root||'/'||trim(leading '/' from f.col_names)
225225
else
226226
f.col_names
227227
end||'($|/.*)' )

0 commit comments

Comments
 (0)