Skip to content

Commit 776cc32

Browse files
committed
Fixed examples execution and improved performance and visibility for examples.
1 parent 91fd638 commit 776cc32

2 files changed

Lines changed: 19 additions & 16 deletions

File tree

examples/RunAllExamples.sql

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,12 @@ prompt RunExampleTestAnnotationsHugePackage
2121
@@RunExampleTestAnnotationsHugePackage.sql
2222
prompt RunExpectations
2323
@@RunExpectations.sql
24-
prompt RunWithDocumentationReporter
24+
2525
@@RunWithDocumentationReporter.sql
2626

27+
--workaround for suite level cache
28+
declare d date := sysdate; begin loop exit when d != sysdate; end loop; end;
29+
/
2730
@@award_bonus/run_award_bonus_test.sql
2831
--workaround for suite level cache
2932
declare d date := sysdate; begin loop exit when d != sysdate; end loop; end;

examples/demo_expectations.pck

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ create or replace package body demo_expectations is
147147
ut.expect( l_actual_timestamp_tz ).to_( equal( l_expected_timestamp_tz ) );
148148
ut.expect( l_actual_varchar2 ).to_( equal( l_expected_varchar2 ) );
149149

150-
open l_actual_cursor for select * from user_objects where rownum <100;
150+
open l_actual_cursor for select * from user_objects where rownum <6;
151151
open l_expected_cursor for select * from user_objects where rownum <5;
152152

153153
ut.expect(l_actual_cursor).to_equal(l_expected_cursor);
@@ -178,7 +178,7 @@ create or replace package body demo_expectations is
178178
ut.expect( l_timestamp ).to_equal( l_timestamp_tz );
179179
ut.expect( l_timestamp_ltz ).to_equal( l_date );
180180
ut.expect( l_varchar2 ).to_equal( l_clob );
181-
open l_cursor for select * from user_objects where rownum <100;
181+
open l_cursor for select * from user_objects where rownum <5;
182182
ut.expect( l_cursor ).to_equal( l_varchar2 );
183183

184184
--using the to_( equal( ) ) matcher
@@ -192,7 +192,7 @@ create or replace package body demo_expectations is
192192
ut.expect( l_timestamp ).to_( equal( l_timestamp_tz ) );
193193
ut.expect( l_timestamp_ltz ).to_( equal( l_date ) );
194194
ut.expect( l_varchar2 ).to_( equal( l_clob ) );
195-
open l_cursor for select * from user_objects where rownum <100;
195+
open l_cursor for select * from user_objects where rownum <5;
196196
ut.expect( l_varchar2 ).to_( equal( l_cursor ) );
197197

198198
end;
@@ -223,8 +223,8 @@ create or replace package body demo_expectations is
223223
ut.expect( l_timestamp_ltz ).to_equal( l_timestamp_ltz );
224224
ut.expect( l_timestamp_tz ).to_equal( l_timestamp_tz );
225225
ut.expect( l_varchar2 ).to_equal( l_varchar2 );
226-
open l_cursor1 for select * from all_objects;
227-
open l_cursor2 for select * from all_objects;
226+
open l_cursor1 for select * from all_objects where rownum <=50;
227+
open l_cursor2 for select * from all_objects where rownum <=50;
228228
ut.expect( l_cursor1 ).to_equal( l_cursor2 );
229229

230230
--using the to_( equal( ) ) matcher
@@ -239,8 +239,8 @@ create or replace package body demo_expectations is
239239
ut.expect( l_timestamp_tz ).to_( equal( l_timestamp_tz ) );
240240
ut.expect( l_varchar2 ).to_( equal( l_varchar2 ) );
241241

242-
open l_cursor1 for select * from all_objects;
243-
open l_cursor2 for select * from all_objects;
242+
open l_cursor1 for select * from all_objects where rownum <=50;
243+
open l_cursor2 for select * from all_objects where rownum <=50;
244244
ut.expect( l_cursor1 ).to_( equal( l_cursor2 ) );
245245
end;
246246

@@ -291,7 +291,7 @@ create or replace package body demo_expectations is
291291
l_timestamp_tz timestamp with time zone := l_timestamp;
292292
l_varchar2 varchar2(100) := 'a string';
293293
begin
294-
open l_cursor for select * from user_objects where rownum <100;
294+
open l_cursor for select * from user_objects where rownum <5;
295295
--using the to_be_null() matcher
296296
ut.expect( l_anydata ).to_be_null();
297297
ut.expect( l_blob ).to_be_null();
@@ -306,7 +306,7 @@ create or replace package body demo_expectations is
306306
ut.expect( l_cursor ).to_be_null;
307307

308308
--using the to_( be_null() ) matcher
309-
open l_cursor for select * from user_objects where rownum <100;
309+
open l_cursor for select * from user_objects where rownum <5;
310310
ut.expect( l_anydata ).to_( be_null() );
311311
ut.expect( l_blob ).to_( be_null() );
312312
ut.expect( l_boolean ).to_( be_null() );
@@ -432,7 +432,7 @@ create or replace package body demo_expectations is
432432
l_timestamp_tz timestamp with time zone := sysdate;
433433
l_varchar2 varchar2(100) := 'a string';
434434
begin
435-
open l_cursor for select * from user_objects where rownum <100;
435+
open l_cursor for select * from user_objects where rownum <5;
436436
--using the to_be_not_null() matcher
437437
ut.expect( l_anydata ).to_be_not_null();
438438
ut.expect( l_blob ).to_be_not_null();
@@ -447,7 +447,7 @@ create or replace package body demo_expectations is
447447
ut.expect( l_cursor ).to_be_not_null;
448448

449449
--using the to_( be_not_null() ) matcher
450-
open l_cursor for select * from user_objects where rownum <100;
450+
open l_cursor for select * from user_objects where rownum <5;
451451
ut.expect( l_anydata ).to_( be_not_null() );
452452
ut.expect( l_blob ).to_( be_not_null() );
453453
ut.expect( l_boolean ).to_( be_not_null() );
@@ -462,7 +462,7 @@ create or replace package body demo_expectations is
462462
end;
463463

464464
procedure demo_to_match_failure is
465-
l_clob clob := rpad('a',32767,'a')||'Stephen';
465+
l_clob clob := 'There was a guy named Stephen';
466466
begin
467467
ut.expect( 'STEPHEN' ).to_match('^Stephen$');
468468
ut.expect( 'stephen ' ).to_match('^Stephen$', 'i'); --case insensitive
@@ -479,7 +479,7 @@ create or replace package body demo_expectations is
479479
end;
480480

481481
procedure demo_to_match_success is
482-
l_clob clob := rpad('a',32767,'a')||'STEPHEN';
482+
l_clob clob := 'There was a guy named STEPHEN';
483483
begin
484484
ut.expect( 'Hi, I am Stephen' ).to_match('Stephen$');
485485
ut.expect( 'stephen' ).to_match('^Stephen$', 'i'); --case insensitive
@@ -492,7 +492,7 @@ create or replace package body demo_expectations is
492492
end;
493493

494494
procedure demo_to_be_like_failure is
495-
l_clob clob := rpad('a',32767,'a')||'Stephen';
495+
l_clob clob := 'There was a guy named Stephen';
496496
begin
497497
ut.expect( 'STEPHEN' ).to_be_like('Stephen');
498498
ut.expect( 'Stephen ' ).to_be_like('Stephen\_', '\'); --escape wildcards with '\'
@@ -509,7 +509,7 @@ create or replace package body demo_expectations is
509509
end;
510510

511511
procedure demo_to_be_like_success is
512-
l_clob clob := rpad('a',32767,'a')||'STEPHEN_';
512+
l_clob clob := 'There was a guy named STEPHEN_';
513513
begin
514514
ut.expect( 'Hi, I am Stephen' ).to_be_like('%Stephen');
515515
ut.expect( 'stephen_' ).to_be_like('_tephen\_', '\'); --escape wildcards with '\'

0 commit comments

Comments
 (0)