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

Skip to content

Commit 314b998

Browse files
committed
Added test for to_contain
1 parent a0ee195 commit 314b998

2 files changed

Lines changed: 50 additions & 0 deletions

File tree

test/core/expectations/test_expectations_cursor.pkb

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2025,6 +2025,50 @@ Diff:%
20252025
%Missing: <ROW><OWNER>%</OWNER><OBJECT_NAME>%</OBJECT_NAME><OBJECT_TYPE>%</OBJECT_TYPE></ROW>
20262026
%Missing: <ROW><OWNER>%</OWNER><OBJECT_NAME>%</OBJECT_NAME><OBJECT_TYPE>%</OBJECT_TYPE></ROW>
20272027
%Missing: <ROW><OWNER>%</OWNER><OBJECT_NAME>%</OBJECT_NAME><OBJECT_TYPE>%</OBJECT_TYPE></ROW>
2028+
%Missing: <ROW><OWNER>%</OWNER><OBJECT_NAME>%</OBJECT_NAME><OBJECT_TYPE>%</OBJECT_TYPE></ROW>%]';
2029+
l_actual_message := ut3.ut_expectation_processor.get_failed_expectations()(1).message;
2030+
--Assert
2031+
ut.expect(l_actual_message).to_be_like(l_expected_message);
2032+
end;
2033+
2034+
procedure cursor_to_contain is
2035+
l_actual SYS_REFCURSOR;
2036+
l_expected SYS_REFCURSOR;
2037+
begin
2038+
--Arrange
2039+
open l_actual for select owner, object_name,object_type from all_objects where owner = user
2040+
order by 1,2,3 asc;
2041+
open l_expected for select owner, object_name,object_type from all_objects where owner = user
2042+
and rownum < 20;
2043+
2044+
--Act
2045+
ut3.ut.expect(l_actual).to_contain(l_expected);
2046+
--Assert
2047+
ut.expect(expectations.failed_expectations_data()).to_be_empty();
2048+
end;
2049+
2050+
procedure cursor_to_contain_fail is
2051+
l_actual SYS_REFCURSOR;
2052+
l_expected SYS_REFCURSOR;
2053+
l_expected_message varchar2(32767);
2054+
l_actual_message varchar2(32767);
2055+
begin
2056+
--Arrange
2057+
open l_actual for select owner, object_name,object_type from all_objects where owner = user
2058+
and rownum < 5;
2059+
open l_expected for select owner, object_name,object_type from all_objects where owner = user
2060+
and rownum < 10;
2061+
2062+
--Act
2063+
ut3.ut.expect(l_actual).to_contain(l_expected);
2064+
--Assert
2065+
l_expected_message := q'[%Actual: refcursor [ count = 4 ] was expected to include: refcursor [ count = 9 ]
2066+
%Diff:
2067+
%Rows: [ 5 differences ]
2068+
%Missing: <ROW><OWNER>%</OWNER><OBJECT_NAME>%</OBJECT_NAME><OBJECT_TYPE>%</OBJECT_TYPE></ROW>
2069+
%Missing: <ROW><OWNER>%</OWNER><OBJECT_NAME>%</OBJECT_NAME><OBJECT_TYPE>%</OBJECT_TYPE></ROW>
2070+
%Missing: <ROW><OWNER>%</OWNER><OBJECT_NAME>%</OBJECT_NAME><OBJECT_TYPE>%</OBJECT_TYPE></ROW>
2071+
%Missing: <ROW><OWNER>%</OWNER><OBJECT_NAME>%</OBJECT_NAME><OBJECT_TYPE>%</OBJECT_TYPE></ROW>
20282072
%Missing: <ROW><OWNER>%</OWNER><OBJECT_NAME>%</OBJECT_NAME><OBJECT_TYPE>%</OBJECT_TYPE></ROW>%]';
20292073
l_actual_message := ut3.ut_expectation_processor.get_failed_expectations()(1).message;
20302074
--Assert

test/core/expectations/test_expectations_cursor.pks

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,12 @@ create or replace package test_expectations_cursor is
322322
--%test( Fail cursor contains data from another cursor )
323323
procedure cursor_contain_fail;
324324

325+
--%test( Cursor contains data from another cursor using second keyword)
326+
procedure cursor_to_contain;
327+
328+
--%test( Fail cursor contains data from another cursor using second keyword)
329+
procedure cursor_to_contain_fail;
330+
325331
--%test( Cursor contains data from another cursor with joinby)
326332
procedure cursor_contain_joinby;
327333

0 commit comments

Comments
 (0)