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

Skip to content

Commit 9002fbc

Browse files
committed
Making tests below 21 compilation conditional so it wont fail.
1 parent 3d3f0be commit 9002fbc

5 files changed

Lines changed: 22 additions & 4 deletions

File tree

source/expectations/data_values/ut_compound_data_helper.pkb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -781,6 +781,17 @@ create or replace package body ut_compound_data_helper is
781781
return l_diffs;
782782
end;
783783

784+
function get_json_object(a_json_t json) return json_element_t is
785+
l_json JSON;
786+
l_obj json_element_t;
787+
begin
788+
$if dbms_db_version.version >= 21 $then
789+
l_obj := case when a_json_t is null then cast (null as json_element_t ) else json_element_t.parse(json_query(a_value, '$' returning clob)) end;
790+
$else
791+
l_obj := null;
792+
$end
793+
end;
794+
784795
begin
785796
g_anytype_name_map(dbms_types.typecode_date) := 'DATE';
786797
g_anytype_name_map(dbms_types.typecode_number) := 'NUMBER';

source/expectations/data_values/ut_compound_data_helper.pks

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,5 +134,7 @@ create or replace package ut_compound_data_helper authid definer is
134134

135135
function get_json_diffs_type(a_diff_id raw) return tt_json_diff_type_tab;
136136

137+
function get_json_object(a_json_t json) return json_element_t;
138+
137139
end;
138140
/

source/expectations/data_values/ut_data_value_json.tpb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ create or replace type body ut_data_value_json as
3333
end;
3434

3535
constructor function ut_data_value_json(self in out nocopy ut_data_value_json, a_value json) return self as result is
36-
l_value json_element_t := case when a_value is null then cast (null as json_element_t ) else json_element_t.parse(json_query(a_value, '$' returning clob)) end;
36+
l_value json_element_t := ut_compound_data_helper.get_json_object(a_value);
3737
begin
3838
init(l_value);
3939
return;

test/ut3_user/expectations/test_expectations_json.pkb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1607,7 +1607,8 @@ create or replace package body test_expectations_json is
16071607
ut.expect(ut3_tester_helper.main_helper.get_failed_expectations_num).to_equal(0);
16081608
end;
16091609

1610-
1610+
$if dbms_db_version.version >= 21 $then
1611+
16111612
procedure success_on_same_data_njson
16121613
as
16131614
l_actual json;
@@ -1781,6 +1782,7 @@ create or replace package body test_expectations_json is
17811782
--Assert
17821783
ut.expect(l_actual_message).to_be_like(l_expected_message);
17831784
end;
1784-
1785+
1786+
$end
17851787
end;
17861788
/

test/ut3_user/expectations/test_expectations_json.pks

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ create or replace package test_expectations_json is
7575
--%test( Compare two json arrays )
7676
procedure check_json_arrays;
7777

78+
$if dbms_db_version.version >= 21 $then
79+
7880
--%test(Gives success for identical data using native json for 21c and above)
7981
procedure success_on_same_data_njson;
8082

@@ -95,6 +97,7 @@ create or replace package test_expectations_json is
9597

9698
--%test( Fail Json object not to have count using native json for 21c and above)
9799
procedure fail_not_to_have_count_njson;
98-
100+
101+
$end
99102
end;
100103
/

0 commit comments

Comments
 (0)