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

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Fixed examples execution and improved performance and visibility for …
…examples.
  • Loading branch information
jgebal committed Dec 14, 2016
commit 776cc326bac1e85c47d6a906b66d3caa7f8f354f
5 changes: 4 additions & 1 deletion examples/RunAllExamples.sql
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,12 @@ prompt RunExampleTestAnnotationsHugePackage
@@RunExampleTestAnnotationsHugePackage.sql
prompt RunExpectations
@@RunExpectations.sql
prompt RunWithDocumentationReporter

@@RunWithDocumentationReporter.sql

--workaround for suite level cache
declare d date := sysdate; begin loop exit when d != sysdate; end loop; end;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cache invalidation is fixed in another PR, no more need in that

/
@@award_bonus/run_award_bonus_test.sql
--workaround for suite level cache
declare d date := sysdate; begin loop exit when d != sysdate; end loop; end;
Expand Down
30 changes: 15 additions & 15 deletions examples/demo_expectations.pck
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ create or replace package body demo_expectations is
ut.expect( l_actual_timestamp_tz ).to_( equal( l_expected_timestamp_tz ) );
ut.expect( l_actual_varchar2 ).to_( equal( l_expected_varchar2 ) );

open l_actual_cursor for select * from user_objects where rownum <100;
open l_actual_cursor for select * from user_objects where rownum <6;
open l_expected_cursor for select * from user_objects where rownum <5;

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

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

end;
Expand Down Expand Up @@ -223,8 +223,8 @@ create or replace package body demo_expectations is
ut.expect( l_timestamp_ltz ).to_equal( l_timestamp_ltz );
ut.expect( l_timestamp_tz ).to_equal( l_timestamp_tz );
ut.expect( l_varchar2 ).to_equal( l_varchar2 );
open l_cursor1 for select * from all_objects;
open l_cursor2 for select * from all_objects;
open l_cursor1 for select * from all_objects where rownum <=50;
open l_cursor2 for select * from all_objects where rownum <=50;
ut.expect( l_cursor1 ).to_equal( l_cursor2 );

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

open l_cursor1 for select * from all_objects;
open l_cursor2 for select * from all_objects;
open l_cursor1 for select * from all_objects where rownum <=50;
open l_cursor2 for select * from all_objects where rownum <=50;
ut.expect( l_cursor1 ).to_( equal( l_cursor2 ) );
end;

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

--using the to_( be_null() ) matcher
open l_cursor for select * from user_objects where rownum <100;
open l_cursor for select * from user_objects where rownum <5;
ut.expect( l_anydata ).to_( be_null() );
ut.expect( l_blob ).to_( be_null() );
ut.expect( l_boolean ).to_( be_null() );
Expand Down Expand Up @@ -432,7 +432,7 @@ create or replace package body demo_expectations is
l_timestamp_tz timestamp with time zone := sysdate;
l_varchar2 varchar2(100) := 'a string';
begin
open l_cursor for select * from user_objects where rownum <100;
open l_cursor for select * from user_objects where rownum <5;
--using the to_be_not_null() matcher
ut.expect( l_anydata ).to_be_not_null();
ut.expect( l_blob ).to_be_not_null();
Expand All @@ -447,7 +447,7 @@ create or replace package body demo_expectations is
ut.expect( l_cursor ).to_be_not_null;

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

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

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

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

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