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

Skip to content

not_to(contain) fails while not_to_contain passes #1245

Closed
@micdol

Description

@micdol

Describe the bug
Logically not_to(contain) should be the same as not_to_contain however the former fails while the latter passes. See reproduction steps for code.

Provide version info
utPLSQL: v3.1.14.4072-develop
Database: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Version 19.18.0.0.0

Information about client software
SQLDeveloper, SQLPlus cmd line

To Reproduce

create or replace package example as
    --%suite(example)

    --%test
    procedure not_to_contain_passes;

    --%test
    procedure not_to_bracket_contain_bracket_fails;
end;
/

create or replace package body example as
    procedure not_to_contain_passes
        is
        c1 sys_refcursor;
        c2 sys_refcursor;
    begin
        open c1 for select 'a' as letter from dual union all select 'b' from dual;
        open c2 for select 'c' as letter from dual;
        ut.expect(c1).not_to_contain(c2); -- !!!
    end not_to_contain_passes;

    procedure not_to_bracket_contain_bracket_fails
        is
        c1 sys_refcursor;
        c2 sys_refcursor;
    begin
        open c1 for select 'a' as letter from dual union all select 'b' from dual;
        open c2 for select 'c' as letter from dual;
        ut.expect(c1).not_to(contain(c2)); -- !!!!
    end not_to_bracket_contain_bracket_fails;
end;
/

set serveroutput on;
execute ut.run(a_path => 'example');

Output:

example
  not_to_contain_passes [,011 sec]
  not_to_bracket_contain_bracket_fails [,014 sec] (FAILED - 1)
 
Failures:
 
  1) not_to_bracket_contain_bracket_fails
      Actual: (refcursor [ count = 2 ])
          Data-types:
          <LETTER>CHAR</LETTER>
          Data:
          <ROW><LETTER>a</LETTER></ROW><ROW><LETTER>b</LETTER></ROW>
       was expected not to contain:(refcursor [ count = 1 ])
          Data-types:
          <LETTER>CHAR</LETTER>
          Data:
          <ROW><LETTER>c</LETTER></ROW>
      at "RDP_MYCO_APEX_UT.EXAMPLE.NOT_TO_BRACKET_CONTAIN_BRACKET_FAILS", line 19 ut.expect(c1).not_to(contain(c2)); -- !!!!
       
Finished in ,026737 seconds
2 tests, 1 failed, 0 errored, 0 disabled, 0 warning(s)

Expected behavior
not_to_contain should work the same way as not_to(contain)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions