From d33bd80f4a1b5c7e1c5188fa04ac5fcdfde9bf73 Mon Sep 17 00:00:00 2001 From: Jacek Gebal Date: Thu, 2 Jan 2020 19:11:57 +0000 Subject: [PATCH 1/3] Updated documentation for whitespace vs null compare. Updated tests o represent the issue more clearly. Closes #880 --- docs/userguide/expectations.md | 3 +- .../expectations/test_expectations_cursor.pkb | 56 +++++++------------ .../expectations/test_expectations_cursor.pks | 36 ++++++------ 3 files changed, 39 insertions(+), 56 deletions(-) diff --git a/docs/userguide/expectations.md b/docs/userguide/expectations.md index 612b59444..9cd665314 100644 --- a/docs/userguide/expectations.md +++ b/docs/userguide/expectations.md @@ -1114,7 +1114,8 @@ utPLSQL is capable of comparing compound data-types including: - 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 - 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)) - 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) - +- 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 + 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.* utPLSQL offers advanced data-comparison options, for comparing compound data-types. The options allow you to: - define columns/attributes to exclude from comparison diff --git a/test/ut3_user/expectations/test_expectations_cursor.pkb b/test/ut3_user/expectations/test_expectations_cursor.pkb index 1c6f46532..054c65e17 100644 --- a/test/ut3_user/expectations/test_expectations_cursor.pkb +++ b/test/ut3_user/expectations/test_expectations_cursor.pkb @@ -2639,7 +2639,7 @@ Check the query and data for errors.'; end; - procedure insginificant_whitespace1 is + procedure space_only_vs_empty is l_actual sys_refcursor; l_expected sys_refcursor; begin @@ -2650,79 +2650,65 @@ Check the query and data for errors.'; select column_value t1 from table(ut_varchar2_list(' ')); --Assert ut3.ut.expect( l_actual ).to_equal( l_expected ); - ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0); + ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0); end; - procedure insginificant_whitespace2 is + procedure tab_only_vs_empty is l_actual sys_refcursor; l_expected sys_refcursor; begin open l_expected for - select ' t ' t1 from dual; - + select column_value t1 from table(ut_varchar2_list('')); + open l_actual for - select 't' t1 from dual; + select column_value t1 from table(ut_varchar2_list(chr(9))); --Assert ut3.ut.expect( l_actual ).to_equal( l_expected ); - ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0); - end; - - procedure insginificant_whitespace3 is - l_actual sys_refcursor; - l_expected sys_refcursor; - begin - open l_expected for - select 't ' t1 from dual; - - open l_actual for - select 't' t1 from dual; - --Assert - ut3.ut.expect( l_actual ).to_equal( l_expected ); - ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0); + ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0); end; - - procedure insginificant_whitespace4 is + + procedure insignificant_start_end_space is l_actual sys_refcursor; l_expected sys_refcursor; begin open l_expected for - select ' t' t1 from dual; + select ' t ' t1 from dual; open l_actual for select 't' t1 from dual; --Assert ut3.ut.expect( l_actual ).to_equal( l_expected ); - ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0); - end; + ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0); + end; - procedure insginificant_whitespace5 is + procedure double_vs_single_start_end_ws is l_actual sys_refcursor; l_expected sys_refcursor; begin open l_expected for - select ' ' t1 from dual; + select ' t ' t1 from dual; open l_actual for - select '' t1 from dual; + select ' t ' t1 from dual; --Assert ut3.ut.expect( l_actual ).to_equal( l_expected ); ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0); - end; + end; - procedure nulltowhitespace is + procedure leading_tab_vs_space is l_actual sys_refcursor; l_expected sys_refcursor; begin open l_expected for - select cast(null as varchar2(2)) t1 from dual; + select ' t' t1 from dual; open l_actual for - select ' ' t1 from dual; + select chr(9)||'t' t1 from dual; --Assert ut3.ut.expect( l_actual ).to_equal( l_expected ); ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_be_greater_than(0); - end; - + end; + procedure number_from_dual is l_actual sys_refcursor; l_expected sys_refcursor; diff --git a/test/ut3_user/expectations/test_expectations_cursor.pks b/test/ut3_user/expectations/test_expectations_cursor.pks index d3dbeb9a7..0ed249a49 100644 --- a/test/ut3_user/expectations/test_expectations_cursor.pks +++ b/test/ut3_user/expectations/test_expectations_cursor.pks @@ -417,31 +417,27 @@ create or replace package test_expectations_cursor is --%test(Check that column name accept non xml characters fix #902) procedure nonxmlchar_part_of_colname; - - - /*Oracle Bug not readin properly in xmltable */ - --%test ( Compare insiginificant whitespaces scenario 1 ) + + + /*Oracle Bug not reading properly in XMLTable - See - Issue #880 */ + --%disabled + --%test ( Space-only string is not equal empty string ) + procedure space_only_vs_empty; + + /*Oracle Bug not reading properly in XMLTable - See - Issue #880 */ --%disabled - procedure insginificant_whitespace1; + --%test ( Tab-only string is not equal empty string ) + procedure tab_only_vs_empty; - --%test ( Compare insiginificant whitespaces scenario 2 ) - procedure insginificant_whitespace2; + --%test ( Insignificant start/end whitespaces are considered ) + procedure insignificant_start_end_space; - --%test ( Compare insiginificant whitespaces scenario 3 ) - procedure insginificant_whitespace3; + --%test ( Double and single leading/trailing space is distinguished ) + procedure double_vs_single_start_end_ws; - --%test ( Compare insiginificant whitespaces scenario 4 ) - procedure insginificant_whitespace4; + --%test ( Leading Tab vs. Space is distinguished ) + procedure leading_tab_vs_space; - /*Oracle Bug not readin properly in xmltable */ - --%test ( Compare insiginificant whitespaces scenario 5 ) - --%disabled - procedure insginificant_whitespace5; - - /*Oracle Bug not readin properly in xmltable */ - --%test ( Compare null to whitespace ) - --%disabled - procedure nulltowhitespace; --%test(Check precision of number from dual #907) procedure number_from_dual; From 5510555c3b6cea45f273cb4135e811e959ce1877 Mon Sep 17 00:00:00 2001 From: Jacek Gebal Date: Fri, 3 Jan 2020 05:23:44 +0000 Subject: [PATCH 2/3] Fixed documentation. --- docs/userguide/expectations.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/userguide/expectations.md b/docs/userguide/expectations.md index 9cd665314..9f2842e2f 100644 --- a/docs/userguide/expectations.md +++ b/docs/userguide/expectations.md @@ -1114,7 +1114,7 @@ utPLSQL is capable of comparing compound data-types including: - 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 - 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)) - 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) -- 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 +- utPLSQL is not able to distinguish between a NULL and whitespace-only column/attribute from when comparing compound data. This is due to Oracle limitation on of XMLType. 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.* utPLSQL offers advanced data-comparison options, for comparing compound data-types. The options allow you to: From d708443346b73a92fed3310605d4fa2a93ad914c Mon Sep 17 00:00:00 2001 From: Jacek Gebal Date: Sat, 4 Jan 2020 10:45:23 +0000 Subject: [PATCH 3/3] Fixed documentation typos. --- docs/userguide/expectations.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/userguide/expectations.md b/docs/userguide/expectations.md index 9f2842e2f..6410fc6f1 100644 --- a/docs/userguide/expectations.md +++ b/docs/userguide/expectations.md @@ -1114,8 +1114,8 @@ utPLSQL is capable of comparing compound data-types including: - 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 - 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)) - 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) -- utPLSQL is not able to distinguish between a NULL and whitespace-only column/attribute from when comparing compound data. This is due to Oracle limitation on of XMLType. - 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.* +- utPLSQL is not able to distinguish between NULL and whitespace-only column/attribute value when comparing compound data. This is due to Oracle limitation on of XMLType. + See [issue #880](https://github.com/utPLSQL/utPLSQL/issues/880) for details. *Note: This behavior might be fixed in future releases, when utPLSQL is no longer depending on XMLType for compound data comparison.* utPLSQL offers advanced data-comparison options, for comparing compound data-types. The options allow you to: - define columns/attributes to exclude from comparison