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

Skip to content

Commit d33bd80

Browse files
committed
Updated documentation for whitespace vs null compare.
Updated tests o represent the issue more clearly. Closes #880
1 parent 33f5152 commit d33bd80

3 files changed

Lines changed: 39 additions & 56 deletions

File tree

docs/userguide/expectations.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1114,7 +1114,8 @@ utPLSQL is capable of comparing compound data-types including:
11141114
- It is possible to compare PL/SQL records, collections, varrays and associative arrays. To compare this types of data, use cursor comparison feature of utPLSQL and TABLE operator in SQL query
11151115
- On Oracle 11g Release 2 - pipelined table functions are needed (see section [Implicit (Shadow) Types in this artcile](https://oracle-base.com/articles/misc/pipelined-table-functions))
11161116
- On Oracle 12c and above - use [TABLE function on nested tables/varrays/associative arrays of PL/SQL records](https://oracle-base.com/articles/12c/using-the-table-operator-with-locally-defined-types-in-plsql-12cr1)
1117-
1117+
- utPLSQL is not able to distinguish a NULL column/attribute from a column/attribute containing whitespace-only when comparing compound data. This is due to Oracle limitation on of XMLType., utPLSQL is not able to distinguish between
1118+
See [issue #880](https://github.com/utPLSQL/utPLSQL/issues/880) for details. *Note: This behavior might be fixed in future relreases, when utPLSQL is no longer depending on XMLType for compound data comparison.*
11181119
11191120
utPLSQL offers advanced data-comparison options, for comparing compound data-types. The options allow you to:
11201121
- define columns/attributes to exclude from comparison

test/ut3_user/expectations/test_expectations_cursor.pkb

Lines changed: 21 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2639,7 +2639,7 @@ Check the query and data for errors.';
26392639
end;
26402640

26412641

2642-
procedure insginificant_whitespace1 is
2642+
procedure space_only_vs_empty is
26432643
l_actual sys_refcursor;
26442644
l_expected sys_refcursor;
26452645
begin
@@ -2650,79 +2650,65 @@ Check the query and data for errors.';
26502650
select column_value t1 from table(ut_varchar2_list(' '));
26512651
--Assert
26522652
ut3.ut.expect( l_actual ).to_equal( l_expected );
2653-
ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
2653+
ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
26542654
end;
26552655

2656-
procedure insginificant_whitespace2 is
2656+
procedure tab_only_vs_empty is
26572657
l_actual sys_refcursor;
26582658
l_expected sys_refcursor;
26592659
begin
26602660
open l_expected for
2661-
select ' t ' t1 from dual;
2662-
2661+
select column_value t1 from table(ut_varchar2_list(''));
2662+
26632663
open l_actual for
2664-
select 't' t1 from dual;
2664+
select column_value t1 from table(ut_varchar2_list(chr(9)));
26652665
--Assert
26662666
ut3.ut.expect( l_actual ).to_equal( l_expected );
2667-
ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
2668-
end;
2669-
2670-
procedure insginificant_whitespace3 is
2671-
l_actual sys_refcursor;
2672-
l_expected sys_refcursor;
2673-
begin
2674-
open l_expected for
2675-
select 't ' t1 from dual;
2676-
2677-
open l_actual for
2678-
select 't' t1 from dual;
2679-
--Assert
2680-
ut3.ut.expect( l_actual ).to_equal( l_expected );
2681-
ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
2667+
ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
26822668
end;
2683-
2684-
procedure insginificant_whitespace4 is
2669+
2670+
procedure insignificant_start_end_space is
26852671
l_actual sys_refcursor;
26862672
l_expected sys_refcursor;
26872673
begin
26882674
open l_expected for
2689-
select ' t' t1 from dual;
2675+
select ' t ' t1 from dual;
26902676

26912677
open l_actual for
26922678
select 't' t1 from dual;
26932679
--Assert
26942680
ut3.ut.expect( l_actual ).to_equal( l_expected );
2695-
ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
2696-
end;
2681+
ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
2682+
end;
26972683

2698-
procedure insginificant_whitespace5 is
2684+
procedure double_vs_single_start_end_ws is
26992685
l_actual sys_refcursor;
27002686
l_expected sys_refcursor;
27012687
begin
27022688
open l_expected for
2703-
select ' ' t1 from dual;
2689+
select ' t ' t1 from dual;
27042690

27052691
open l_actual for
2706-
select '' t1 from dual;
2692+
select ' t ' t1 from dual;
27072693
--Assert
27082694
ut3.ut.expect( l_actual ).to_equal( l_expected );
27092695
ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
2710-
end;
2696+
end;
27112697

2712-
procedure nulltowhitespace is
2698+
procedure leading_tab_vs_space is
27132699
l_actual sys_refcursor;
27142700
l_expected sys_refcursor;
27152701
begin
27162702
open l_expected for
2717-
select cast(null as varchar2(2)) t1 from dual;
2703+
select ' t' t1 from dual;
27182704

27192705
open l_actual for
2720-
select ' ' t1 from dual;
2706+
select chr(9)||'t' t1 from dual;
27212707
--Assert
27222708
ut3.ut.expect( l_actual ).to_equal( l_expected );
27232709
ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0);
2724-
end;
2725-
2710+
end;
2711+
27262712
procedure number_from_dual is
27272713
l_actual sys_refcursor;
27282714
l_expected sys_refcursor;

test/ut3_user/expectations/test_expectations_cursor.pks

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -417,31 +417,27 @@ create or replace package test_expectations_cursor is
417417

418418
--%test(Check that column name accept non xml characters fix #902)
419419
procedure nonxmlchar_part_of_colname;
420-
421-
422-
/*Oracle Bug not readin properly in xmltable */
423-
--%test ( Compare insiginificant whitespaces scenario 1 )
420+
421+
422+
/*Oracle Bug not reading properly in XMLTable - See - Issue #880 */
423+
--%disabled
424+
--%test ( Space-only string is not equal empty string )
425+
procedure space_only_vs_empty;
426+
427+
/*Oracle Bug not reading properly in XMLTable - See - Issue #880 */
424428
--%disabled
425-
procedure insginificant_whitespace1;
429+
--%test ( Tab-only string is not equal empty string )
430+
procedure tab_only_vs_empty;
426431

427-
--%test ( Compare insiginificant whitespaces scenario 2 )
428-
procedure insginificant_whitespace2;
432+
--%test ( Insignificant start/end whitespaces are considered )
433+
procedure insignificant_start_end_space;
429434

430-
--%test ( Compare insiginificant whitespaces scenario 3 )
431-
procedure insginificant_whitespace3;
435+
--%test ( Double and single leading/trailing space is distinguished )
436+
procedure double_vs_single_start_end_ws;
432437

433-
--%test ( Compare insiginificant whitespaces scenario 4 )
434-
procedure insginificant_whitespace4;
438+
--%test ( Leading Tab vs. Space is distinguished )
439+
procedure leading_tab_vs_space;
435440

436-
/*Oracle Bug not readin properly in xmltable */
437-
--%test ( Compare insiginificant whitespaces scenario 5 )
438-
--%disabled
439-
procedure insginificant_whitespace5;
440-
441-
/*Oracle Bug not readin properly in xmltable */
442-
--%test ( Compare null to whitespace )
443-
--%disabled
444-
procedure nulltowhitespace;
445441

446442
--%test(Check precision of number from dual #907)
447443
procedure number_from_dual;

0 commit comments

Comments
 (0)