File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,9 +9,6 @@ whenever oserror exit failure rollback
99cd examples
1010@RunAllExamplesAsTests.sql
1111
12- conn $UT3_USER /$UT3_USER_PASSWORD @//$CONNECTION_STR
13- @RunUserExamples.sql
14-
1512exit
1613
1714SQL
Original file line number Diff line number Diff line change 11PROMPT Run all examples
2- Clear Screen
32set echo off
43set feedback off
54set linesize 1000
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ set echo off
44set feedback off
55set linesize 1000
66
7- exec ut_documentation_reporter . set_color_enabled (true);
7+ exec ut_ansiconsole_helper . color_enabled (true);
88-- developer examples
99prompt RunExampleComplexSuiteWithCustomReporter
1010@@developer_examples/ RunExampleComplexSuiteWithCustomReporter .sql
Original file line number Diff line number Diff line change 11PROMPT Run user examples
2- Clear Screen
3- -- set echo off
4- -- set feedback off
2+ set echo off
3+ set feedback off
54set linesize 1000
65
76prompt Common examples from web
87
9- exec ut_documentation_reporter . set_color_enabled (true);
8+ exec ut_ansiconsole_helper . color_enabled (true);
109@@award_bonus/ run_award_bonus_test .sql
1110
1211@@between_string/ run_betwnstr_test .sql
Original file line number Diff line number Diff line change @@ -378,10 +378,8 @@ create or replace package body ut_utils is
378378 end;
379379
380380 procedure cleanup_temp_tables is
381- pragma autonomous_transaction;
382381 begin
383- execute immediate 'truncate table ut_cursor_data';
384- commit;
382+ execute immediate 'delete from ut_cursor_data';
385383 end;
386384
387385end ut_utils;
Original file line number Diff line number Diff line change @@ -41,7 +41,6 @@ create or replace type body ut_data_value_refcursor as
4141 l_xml xmltype;
4242 c_bulk_rows constant integer := 1000;
4343 l_current_date_format varchar2(4000);
44- pragma autonomous_transaction;
4544 begin
4645 self.is_cursor_null := ut_utils.boolean_to_int(a_value is null);
4746 self.self_type := $$plsql_unit;
@@ -83,15 +82,13 @@ create or replace type body ut_data_value_refcursor as
8382 end if;
8483 dbms_xmlgen.closeContext(l_ctx);
8584 end if;
86- commit;
8785 exception
8886 when others then
8987 ut_expectation_processor.reset_nls_params();
9088 if a_value%isopen then
9189 close a_value;
9290 end if;
9391 dbms_xmlgen.closeContext(l_ctx);
94- rollback;
9592 raise;
9693 end;
9794
Original file line number Diff line number Diff line change 88@@ut_reporters/ test_coverage .pks
99@@ut_reporters/ test_coverage_sonar_reporter .pks
1010@@ut_reporters/ test_coveralls_reporter .pks
11+ @ut_expectations/ test_expectations_cursor .pks
1112
1213@core .pkb
1314@ut_utils/ test_ut_utils .pkb
1819@@ut_reporters/ test_coverage .pkb
1920@@ut_reporters/ test_coverage_sonar_reporter .pkb
2021@@ut_reporters/ test_coveralls_reporter .pkb
22+ @ut_expectations/ test_expectations_cursor .pkb
2123
2224show errors
2325
Original file line number Diff line number Diff line change 1+ create or replace package body test_expectations_cursor is
2+
3+ procedure setup_temp_table_test
4+ as
5+ pragma autonomous_transaction;
6+ begin
7+ execute immediate 'create global temporary table gtt_test_table (
8+ value varchar2(250)
9+ ) on commit delete rows';
10+
11+ end;
12+
13+ procedure cleanup_temp_table_test
14+ as
15+ pragma autonomous_transaction;
16+ begin
17+ execute immediate 'drop table gtt_test_table';
18+ end;
19+
20+ procedure test_cursor_w_temp_table
21+ as
22+ pragma autonomous_transaction;
23+ c_expected sys_refcursor;
24+ c_actual sys_refcursor;
25+ begin
26+
27+ -- Arrange
28+ execute immediate 'insert into gtt_test_table ( value ) values ( ''Test-entry'' )';
29+
30+ open c_expected for select 'Test-entry' as value from dual;
31+ open c_actual for 'select * from gtt_test_table';
32+
33+ --Act - execute the expectation on cursor opened on GTT
34+ ut3.ut.expect( c_actual ).to_equal( a_expected => c_expected );
35+
36+ --Assert - check that expectation was executed successfully
37+ ut.expect(ut3.ut_expectation_processor.get_status()).to_equal(ut3.ut_utils.tr_success);
38+
39+ --Cleanup
40+ ut3.ut_expectation_processor.clear_expectations();
41+
42+ rollback;
43+ end;
44+ end;
45+ /
Original file line number Diff line number Diff line change 1+ create or replace package test_expectations_cursor is
2+
3+ --%suite(expectations - cursor)
4+ --%suitepath(utplsql.core.expectations.cursor)
5+
6+
7+ procedure setup_temp_table_test;
8+ procedure cleanup_temp_table_test;
9+
10+ --%test(Test cursor on temporary table)
11+ --%beforetest(setup_temp_table_test)
12+ --%aftertest(cleanup_temp_table_test)
13+ procedure test_cursor_w_temp_table;
14+ end;
15+ /
You can’t perform that action at this time.
0 commit comments