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

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions source/core/types/ut_results_counter.tpb
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ create or replace type body ut_results_counter as
self.warnings_count := self.warnings_count + a_item.warnings_count;
end;

member procedure increase_warning_count(self in out nocopy ut_results_counter) is
member procedure increase_warning_count(self in out nocopy ut_results_counter, a_count integer := 1) is
begin
self.warnings_count := self.warnings_count + 1;
self.warnings_count := self.warnings_count + nvl(a_count,0);
end;

member function total_count return integer is
Expand Down
2 changes: 1 addition & 1 deletion source/core/types/ut_results_counter.tps
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ create or replace type ut_results_counter as object(
constructor function ut_results_counter(self in out nocopy ut_results_counter) return self as result,
member procedure set_counter_values(self in out nocopy ut_results_counter, a_status integer),
member procedure sum_counter_values(self in out nocopy ut_results_counter, a_item ut_results_counter),
member procedure increase_warning_count(self in out nocopy ut_results_counter),
member procedure increase_warning_count(self in out nocopy ut_results_counter, a_count integer := 1),
member function total_count return integer,
member function result_status return integer
)
Expand Down
7 changes: 5 additions & 2 deletions source/core/types/ut_test.tpb
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ create or replace type body ut_test as
end;

overriding member procedure calc_execution_result(self in out nocopy ut_test) is
l_warnings ut_varchar2_list;
begin
if self.get_error_stack_traces().count = 0 then
self.result := ut_expectation_processor.get_status();
Expand All @@ -122,9 +123,11 @@ create or replace type body ut_test as
--expectation results need to be part of test results
self.all_expectations := ut_expectation_processor.get_all_expectations();
self.failed_expectations := ut_expectation_processor.get_failed_expectations();
self.warnings := self.warnings multiset union all ut_expectation_processor.get_warnings();
ut_expectation_processor.clear_expectations();
l_warnings := coalesce( ut_expectation_processor.get_warnings(), ut_varchar2_list() );
self.warnings := self.warnings multiset union all l_warnings;
self.results_count.increase_warning_count( cardinality(l_warnings) );
self.results_count.set_counter_values(self.result);
ut_expectation_processor.clear_expectations();
end;

overriding member procedure mark_as_errored(self in out nocopy ut_test, a_listener in out nocopy ut_event_listener_base, a_error_stack_trace varchar2) is
Expand Down
8 changes: 8 additions & 0 deletions source/core/ut_expectation_processor.pkb
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,14 @@ create or replace package body ut_expectation_processor as
g_warnings(g_warnings.last) := a_messsage;
end;

procedure add_depreciation_warning(a_deprecated_syntax varchar2, a_new_syntax varchar2) is
begin
add_warning(
ut_utils.build_depreciation_warning( a_deprecated_syntax, a_new_syntax ) || chr(10)
|| ut_expectation_processor.who_called_expectation(dbms_utility.format_call_stack())
);
end;

function get_warnings return ut_varchar2_list is
begin
return g_warnings;
Expand Down
2 changes: 2 additions & 0 deletions source/core/ut_expectation_processor.pks
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ create or replace package ut_expectation_processor authid current_user as

procedure add_warning(a_messsage varchar2);

procedure add_depreciation_warning(a_deprecated_syntax varchar2, a_new_syntax varchar2);

function get_warnings return ut_varchar2_list;

function invalidation_exception_found return boolean;
Expand Down
4 changes: 2 additions & 2 deletions source/core/ut_utils.pkb
Original file line number Diff line number Diff line change
Expand Up @@ -496,9 +496,9 @@ procedure append_to_clob(a_src_clob in out nocopy clob, a_clob_table t_clob_tab,

function build_depreciation_warning(a_old_syntax varchar2, a_new_syntax varchar2) return varchar2 is
begin
return 'The syntax: "'||a_old_syntax||'" is depreciated.' ||chr(10)||
return 'The syntax: "'||a_old_syntax||'" is deprecated.' ||chr(10)||
'Please use the new syntax: "'||a_new_syntax||'".' ||chr(10)||
'The depreciated syntax will not be supported in future releases.';
'The deprecated syntax will not be supported in future releases.';
end;

function to_xml_number_format(a_value number) return varchar2 is
Expand Down
34 changes: 13 additions & 21 deletions source/expectations/matchers/ut_equal.tpb
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,11 @@ create or replace type body ut_equal as
end;

constructor function ut_equal(self in out nocopy ut_equal, a_expected anydata, a_exclude varchar2, a_nulls_are_equal boolean := null) return self as result is
l_depreciated integer;
l_deprecated integer;
begin
ut_expectation_processor.add_warning(
ut_utils.build_depreciation_warning(
'equal( a_expected anydata, a_exclude varchar2 )',
'equal( a_expected anydata ).exclude( a_exclude varchar2 )'
)
ut_expectation_processor.add_depreciation_warning(
'equal( a_expected anydata, a_exclude varchar2 )',
'equal( a_expected anydata ).exclude( a_exclude varchar2 )'
);
init(ut_data_value_anydata.get_instance(a_expected), a_nulls_are_equal);
exclude_list := ut_varchar2_list(a_exclude);
Expand All @@ -53,11 +51,9 @@ create or replace type body ut_equal as

constructor function ut_equal(self in out nocopy ut_equal, a_expected anydata, a_exclude ut_varchar2_list, a_nulls_are_equal boolean := null) return self as result is
begin
ut_expectation_processor.add_warning(
ut_utils.build_depreciation_warning(
'equal( a_expected anydata, a_exclude ut_varchar2_list )',
'equal( a_expected anydata ).exclude( a_exclude ut_varchar2_list )'
)
ut_expectation_processor.add_depreciation_warning(
'equal( a_expected anydata, a_exclude ut_varchar2_list )',
'equal( a_expected anydata ).exclude( a_exclude ut_varchar2_list )'
);
init(ut_data_value_anydata.get_instance(a_expected), a_nulls_are_equal);
exclude_list := coalesce(a_exclude, ut_varchar2_list());
Expand Down Expand Up @@ -102,11 +98,9 @@ create or replace type body ut_equal as

constructor function ut_equal(self in out nocopy ut_equal, a_expected sys_refcursor, a_exclude varchar2, a_nulls_are_equal boolean := null) return self as result is
begin
ut_expectation_processor.add_warning(
ut_utils.build_depreciation_warning(
'equal( a_expected sys_refcursor, a_exclude varchar2 )',
'equal( a_expected sys_refcursor ).exclude( a_exclude varchar2 )'
)
ut_expectation_processor.add_depreciation_warning(
'equal( a_expected sys_refcursor, a_exclude varchar2 )',
'equal( a_expected sys_refcursor ).exclude( a_exclude varchar2 )'
);
init(ut_data_value_refcursor(a_expected), a_nulls_are_equal);
exclude_list := ut_varchar2_list(a_exclude);
Expand All @@ -115,11 +109,9 @@ create or replace type body ut_equal as

constructor function ut_equal(self in out nocopy ut_equal, a_expected sys_refcursor, a_exclude ut_varchar2_list, a_nulls_are_equal boolean := null) return self as result is
begin
ut_expectation_processor.add_warning(
ut_utils.build_depreciation_warning(
'equal( a_expected sys_refcursor, a_exclude ut_varchar2_list )',
'equal( a_expected sys_refcursor ).exclude( a_exclude ut_varchar2_list )'
)
ut_expectation_processor.add_depreciation_warning(
'equal( a_expected sys_refcursor, a_exclude ut_varchar2_list )',
'equal( a_expected sys_refcursor ).exclude( a_exclude ut_varchar2_list )'
);
init(ut_data_value_refcursor(a_expected), a_nulls_are_equal);
exclude_list := coalesce(a_exclude, ut_varchar2_list());
Expand Down
48 changes: 18 additions & 30 deletions source/expectations/ut_expectation.tpb
Original file line number Diff line number Diff line change
Expand Up @@ -138,22 +138,18 @@ create or replace type body ut_expectation as

member procedure to_equal(self in ut_expectation, a_expected sys_refcursor, a_exclude varchar2, a_nulls_are_equal boolean := null) is
begin
ut_expectation_processor.add_warning(
ut_utils.build_depreciation_warning(
'to_equal( a_expected sys_refcursor, a_exclude varchar2 )',
'to_equal( a_expected sys_refcursor ).exclude( a_exclude varchar2 )'
)
ut_expectation_processor.add_depreciation_warning(
'to_equal( a_expected sys_refcursor, a_exclude varchar2 )',
'to_equal( a_expected sys_refcursor ).exclude( a_exclude varchar2 )'
);
self.to_( ut_equal(a_expected, a_nulls_are_equal).exclude(a_exclude) );
end;

member procedure to_equal(self in ut_expectation, a_expected sys_refcursor, a_exclude ut_varchar2_list, a_nulls_are_equal boolean := null) is
begin
ut_expectation_processor.add_warning(
ut_utils.build_depreciation_warning(
'to_equal( a_expected sys_refcursor, a_exclude ut_varchar2_list )',
'to_equal( a_expected sys_refcursor ).exclude( a_exclude ut_varchar2_list )'
)
ut_expectation_processor.add_depreciation_warning(
'to_equal( a_expected sys_refcursor, a_exclude ut_varchar2_list )',
'to_equal( a_expected sys_refcursor ).exclude( a_exclude ut_varchar2_list )'
);
self.to_( ut_equal(a_expected, a_nulls_are_equal).exclude(a_exclude) );
end;
Expand Down Expand Up @@ -196,22 +192,18 @@ create or replace type body ut_expectation as

member procedure not_to_equal(self in ut_expectation, a_expected anydata, a_exclude varchar2, a_nulls_are_equal boolean := null) is
begin
ut_expectation_processor.add_warning(
ut_utils.build_depreciation_warning(
'not_to_equal( a_expected anydata, a_exclude varchar2 )',
'not_to_equal( a_expected anydata ).exclude( a_exclude varchar2 )'
)
ut_expectation_processor.add_depreciation_warning(
'not_to_equal( a_expected anydata, a_exclude varchar2 )',
'not_to_equal( a_expected anydata ).exclude( a_exclude varchar2 )'
);
self.not_to( ut_equal(a_expected, a_nulls_are_equal).exclude(a_exclude) );
end;

member procedure not_to_equal(self in ut_expectation, a_expected anydata, a_exclude ut_varchar2_list, a_nulls_are_equal boolean := null) is
begin
ut_expectation_processor.add_warning(
ut_utils.build_depreciation_warning(
'not_to_equal( a_expected anydata, a_exclude ut_varchar2_list )',
'not_to_equal( a_expected anydata ).exclude( a_exclude ut_varchar2_list )'
)
ut_expectation_processor.add_depreciation_warning(
'not_to_equal( a_expected anydata, a_exclude ut_varchar2_list )',
'not_to_equal( a_expected anydata ).exclude( a_exclude ut_varchar2_list )'
);
self.not_to( ut_equal(a_expected, a_nulls_are_equal).exclude(a_exclude) );
end;
Expand Down Expand Up @@ -248,22 +240,18 @@ create or replace type body ut_expectation as

member procedure not_to_equal(self in ut_expectation, a_expected sys_refcursor, a_exclude varchar2, a_nulls_are_equal boolean := null) is
begin
ut_expectation_processor.add_warning(
ut_utils.build_depreciation_warning(
'not_to_equal( a_expected sys_refcursor, a_exclude varchar2 )',
'not_to_equal( a_expected sys_refcursor ).exclude( a_exclude varchar2 )'
)
ut_expectation_processor.add_depreciation_warning(
'not_to_equal( a_expected sys_refcursor, a_exclude varchar2 )',
'not_to_equal( a_expected sys_refcursor ).exclude( a_exclude varchar2 )'
);
self.not_to( ut_equal(a_expected, a_nulls_are_equal).exclude(a_exclude) );
end;

member procedure not_to_equal(self in ut_expectation, a_expected sys_refcursor, a_exclude ut_varchar2_list, a_nulls_are_equal boolean := null) is
begin
ut_expectation_processor.add_warning(
ut_utils.build_depreciation_warning(
'not_to_equal( a_expected sys_refcursor, a_exclude ut_varchar2_list )',
'not_to_equal( a_expected sys_refcursor ).exclude( a_exclude ut_varchar2_list )'
)
ut_expectation_processor.add_depreciation_warning(
'not_to_equal( a_expected sys_refcursor, a_exclude ut_varchar2_list )',
'not_to_equal( a_expected sys_refcursor ).exclude( a_exclude ut_varchar2_list )'
);
self.not_to( ut_equal(a_expected, a_nulls_are_equal).exclude(a_exclude) );
end;
Expand Down
4 changes: 1 addition & 3 deletions source/reporters/ut_documentation_reporter.tpb
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,7 @@ create or replace type body ut_documentation_reporter is
if a_item is of (ut_logical_suite) then
l_items := treat(a_item as ut_logical_suite).items;
for i in 1 .. l_items.count loop
if l_items(i) is of(ut_suite_item) then
print_item_warnings(l_items(i));
end if;
print_item_warnings(l_items(i));
end loop;
end if;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ Rows: [ 1 differences ]
ut3.ut.expect(get_anydata()).to_equal(get_anydata(), a_exclude => 'A_COLUMN,Some_Col');
--Assert
ut.expect(cardinality(ut3.ut_expectation_processor.get_warnings())).to_equal(1);
ut.expect(ut3.ut_expectation_processor.get_warnings()(1)).to_be_like('The syntax: "%" is depreciated.%');
ut.expect(ut3.ut_expectation_processor.get_warnings()(1)).to_be_like('The syntax: "%" is deprecated.%');
end;

procedure deprec_to_equal_excl_list is
Expand All @@ -410,7 +410,7 @@ Rows: [ 1 differences ]
ut3.ut.expect(get_anydata()).to_equal(get_anydata(), a_exclude => ut3.ut_varchar2_list('A_COLUMN','Some_Col'));
--Assert
ut.expect(cardinality(ut3.ut_expectation_processor.get_warnings())).to_equal(1);
ut.expect(ut3.ut_expectation_processor.get_warnings()(1)).to_be_like('The syntax: "%" is depreciated.%');
ut.expect(ut3.ut_expectation_processor.get_warnings()(1)).to_be_like('The syntax: "%" is deprecated.%');
end;

procedure deprec_not_to_equal_excl_varch is
Expand All @@ -419,7 +419,7 @@ Rows: [ 1 differences ]
ut3.ut.expect(get_anydata()).not_to_equal(get_anydata(), a_exclude => 'A_COLUMN,Some_Col');
--Assert
ut.expect(cardinality(ut3.ut_expectation_processor.get_warnings())).to_equal(1);
ut.expect(ut3.ut_expectation_processor.get_warnings()(1)).to_be_like('The syntax: "%" is depreciated.%');
ut.expect(ut3.ut_expectation_processor.get_warnings()(1)).to_be_like('The syntax: "%" is deprecated.%');
end;

procedure deprec_not_to_equal_excl_list is
Expand All @@ -428,7 +428,7 @@ Rows: [ 1 differences ]
ut3.ut.expect(get_anydata()).not_to_equal(get_anydata(), a_exclude => ut3.ut_varchar2_list('A_COLUMN','Some_Col'));
--Assert
ut.expect(cardinality(ut3.ut_expectation_processor.get_warnings())).to_equal(1);
ut.expect(ut3.ut_expectation_processor.get_warnings()(1)).to_be_like('The syntax: "%" is depreciated.%');
ut.expect(ut3.ut_expectation_processor.get_warnings()(1)).to_be_like('The syntax: "%" is deprecated.%');
end;

procedure deprec_equal_excl_varch is
Expand All @@ -437,7 +437,7 @@ Rows: [ 1 differences ]
ut3.ut.expect(get_anydata()).to_(ut3.equal(get_anydata(), a_exclude => 'A_COLUMN,Some_Col'));
--Assert
ut.expect(cardinality(ut3.ut_expectation_processor.get_warnings())).to_equal(1);
ut.expect(ut3.ut_expectation_processor.get_warnings()(1)).to_be_like('The syntax: "%" is depreciated.%');
ut.expect(ut3.ut_expectation_processor.get_warnings()(1)).to_be_like('The syntax: "%" is deprecated.%');
end;

procedure deprec_equal_excl_list is
Expand All @@ -446,7 +446,7 @@ Rows: [ 1 differences ]
ut3.ut.expect(get_anydata()).to_(ut3.equal(get_anydata(), a_exclude => ut3.ut_varchar2_list('A_COLUMN','Some_Col')));
--Assert
ut.expect(cardinality(ut3.ut_expectation_processor.get_warnings())).to_equal(1);
ut.expect(ut3.ut_expectation_processor.get_warnings()(1)).to_be_like('The syntax: "%" is depreciated.%');
ut.expect(ut3.ut_expectation_processor.get_warnings()(1)).to_be_like('The syntax: "%" is deprecated.%');
end;

--%test(Reports only mismatched columns on column data mismatch)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -915,7 +915,7 @@ Rows: [ 4 differences ]
ut3.ut.expect(get_cursor()).to_equal(get_cursor(), a_exclude => 'A_COLUMN,Some_Col');
--Assert
ut.expect(cardinality(ut3.ut_expectation_processor.get_warnings())).to_equal(1);
ut.expect(ut3.ut_expectation_processor.get_warnings()(1)).to_be_like('The syntax: "%" is depreciated.%');
ut.expect(ut3.ut_expectation_processor.get_warnings()(1)).to_be_like('The syntax: "%" is deprecated.%');
end;

procedure deprec_to_equal_excl_list is
Expand All @@ -924,7 +924,7 @@ Rows: [ 4 differences ]
ut3.ut.expect(get_cursor()).to_equal(get_cursor(), a_exclude => ut3.ut_varchar2_list('A_COLUMN','Some_Col'));
--Assert
ut.expect(cardinality(ut3.ut_expectation_processor.get_warnings())).to_equal(1);
ut.expect(ut3.ut_expectation_processor.get_warnings()(1)).to_be_like('The syntax: "%" is depreciated.%');
ut.expect(ut3.ut_expectation_processor.get_warnings()(1)).to_be_like('The syntax: "%" is deprecated.%');
end;

procedure deprec_not_to_equal_excl_varch is
Expand All @@ -933,7 +933,7 @@ Rows: [ 4 differences ]
ut3.ut.expect(get_cursor()).not_to_equal(get_cursor(), a_exclude => 'A_COLUMN,Some_Col');
--Assert
ut.expect(cardinality(ut3.ut_expectation_processor.get_warnings())).to_equal(1);
ut.expect(ut3.ut_expectation_processor.get_warnings()(1)).to_be_like('The syntax: "%" is depreciated.%');
ut.expect(ut3.ut_expectation_processor.get_warnings()(1)).to_be_like('The syntax: "%" is deprecated.%');
end;

procedure deprec_not_to_equal_excl_list is
Expand All @@ -942,7 +942,7 @@ Rows: [ 4 differences ]
ut3.ut.expect(get_cursor()).not_to_equal(get_cursor(), a_exclude => ut3.ut_varchar2_list('A_COLUMN','Some_Col'));
--Assert
ut.expect(cardinality(ut3.ut_expectation_processor.get_warnings())).to_equal(1);
ut.expect(ut3.ut_expectation_processor.get_warnings()(1)).to_be_like('The syntax: "%" is depreciated.%');
ut.expect(ut3.ut_expectation_processor.get_warnings()(1)).to_be_like('The syntax: "%" is deprecated.%');
end;

procedure deprec_equal_excl_varch is
Expand All @@ -951,7 +951,7 @@ Rows: [ 4 differences ]
ut3.ut.expect(get_cursor()).to_(ut3.equal(get_cursor(), a_exclude => 'A_COLUMN,Some_Col'));
--Assert
ut.expect(cardinality(ut3.ut_expectation_processor.get_warnings())).to_equal(1);
ut.expect(ut3.ut_expectation_processor.get_warnings()(1)).to_be_like('The syntax: "%" is depreciated.%');
ut.expect(ut3.ut_expectation_processor.get_warnings()(1)).to_be_like('The syntax: "%" is deprecated.%');
end;

procedure deprec_equal_excl_list is
Expand All @@ -960,7 +960,7 @@ Rows: [ 4 differences ]
ut3.ut.expect(get_cursor()).to_(ut3.equal(get_cursor(), a_exclude => ut3.ut_varchar2_list('A_COLUMN','Some_Col')));
--Assert
ut.expect(cardinality(ut3.ut_expectation_processor.get_warnings())).to_equal(1);
ut.expect(ut3.ut_expectation_processor.get_warnings()(1)).to_be_like('The syntax: "%" is depreciated.%');
ut.expect(ut3.ut_expectation_processor.get_warnings()(1)).to_be_like('The syntax: "%" is deprecated.%');
end;

end;
Expand Down