8000 Actual reported as expected and vice versa for `JSON_ELEMENT_T` · Issue #1113 · utPLSQL/utPLSQL · GitHub
[go: up one dir, main page]

Skip to content
Actual reported as expected and vice versa for JSON_ELEMENT_T #1113
Closed
@PhilippSalvisberg

Description

@PhilippSalvisberg

Describe the bug

When comparing a JSON_ELEMENT_T value the actual value is reported as expected and the expected value as actual.

The following example was taken from http://utplsql.org/utPLSQL/latest/userguide/expectations.html:

begin
  ut.expect( 'the tested value' ).to_equal('the expected value');
end;
/

The first value is the actual value and the second one is the expected value. This should be true regardless of the compared data type.

Provide version info

21.0.0.0.0
20.0.0


PL/SQL procedure successfully completed.


UT_VERSION                                                  
------------------------------------------------------------
v3.1.11.3466-develop


BANNER                                                                           BANNER_FULL                                              
737C
                                                                                                        BANNER_LEGACY                                                                        CON_ID
-------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------- ----------
Oracle Database 21c Enterprise Edition Release 21.0.0.0.0 - Production           Oracle Database 21c Enterprise Edition Release 21.0.0.0.0 - Production                                                                                           Oracle Database 21c Enterprise Edition Release 21.0.0.0.0 - Production                    0
                                                                                 Version 21.1.0.0.0                                                                                                                                                                                                                                          



PARAMETER                      VALUE                                                           
------------------------------ ----------------------------------------------------------------
NLS_LANGUAGE                   AMERICAN                                                        
NLS_TERRITORY                  AMERICA                                                         
NLS_CURRENCY                   $                                                               
NLS_ISO_CURRENCY               AMERICA                                                         
NLS_NUMERIC_CHARACTERS         .,                                                              
NLS_CALENDAR                   GREGORIAN                                                       
NLS_DATE_FORMAT                DD.MM.YYYY                                                      
NLS_DATE_LANGUAGE              AMERICAN                                                        
NLS_SORT                       BINARY                                                          
NLS_TIME_FORMAT                HH.MI.SSXFF AM                                                  
NLS_TIMESTAMP_FORMAT           DD.MM.YYYY HH24:MI:SSXFF                                        
NLS_TIME_TZ_FORMAT             HH.MI.SSXFF AM TZR                                              
NLS_TIMESTAMP_TZ_FORMAT        DD.MM.YYYY HH24:MI:SSXFF TZR                                    
NLS_DUAL_CURRENCY              $                                                               
NLS_COMP                       BINARY                                                          
NLS_LENGTH_SEMANTICS           BYTE                                                            
NLS_NCHAR_CONV_EXCP            FALSE                                                           

17 rows selected. 


PORT_STRING                                                 
------------------------------------------------------------
x86_64/Linux 2.4.xx

Information about client software

SQL Developer 20.2.0

To Reproduce

1. Compare JSON_ELEMENT_T

Run this code

set serveroutput on
begin
   ut.expect(json_element_t.parse('{"a":"value a"}'))
      .to_equal(json_element_t.parse('{"a":"value b"}'));
end;
/

the output is

FAILURE
  Actual: json was expected to equal: json
  Diff: 1 differences found
  1 unequal values
    Actual value: "value b" was expected to be: "value a" on path: $."a"
  at "anonymous block", line 2


PL/SQL procedure successfully completed.

value a is reported as expected. That's wrong.

2. Compare VARCHAR2

Run this code

set serveroutput on
begin
   ut.expect('value a').to_equal('value b');
end;
/

the output is

FAILURE
  Actual: 'value a' (varchar2) was expected to equal: 'value b' (varchar2)
  at "anonymous block", line 2


PL/SQL procedure successfully completed.

value b is reported as expected. That's correct.

Expected behavior

When comparing a JSON_ELEMENT_T report expected and actual values as for other data types (e.g. NUMBER or VARCHAR2).

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0