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

Skip to content
Prev Previous commit
Next Next commit
Updated documentation.
  • Loading branch information
jgebal committed May 6, 2017
commit b5c8cbccd4b6a9b42d38707ddc849a4fe576d1c9
38 changes: 35 additions & 3 deletions docs/userguide/expectations.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Pseudo-code:
All matchers have shortcuts like:
```sql
ut.expect( a_actual {data-type} ).to_{matcher};
ut.expect( a_actual {data-type} ).not_to{matcher};
ut.expect( a_actual {data-type} ).not_to_{matcher};
```

# Matchers
Expand All @@ -50,6 +50,9 @@ Example:
begin
ut.expect( a_actual => 3 ).to_be_between( a_lower_bound => 1, a_upper_bound => 3 );
ut.expect( 3 ).to_be_between( 1, 3 );
--or
ut.expect( a_actual => 3 ).to_( be_between( a_lower_bound => 1, a_upper_bound => 3 ) );
ut.expect( 3 ).to_( be_between( 1, 3 ) );
end;
```

Expand All @@ -63,6 +66,8 @@ procedure test_if_cursor_is_empty is
begin
open l_cursor for select * from dual where 1 = 0;
ut.expect( l_cursor ).to_be_empty();
--or
ut.expect( l_cursor ).to_( be_empty() );
end;
```

Expand All @@ -75,6 +80,8 @@ Usage:
```sql
begin
ut.expect( ( 1 = 0 ) ).to_be_false();
--or
ut.expect( ( 1 = 0 ) ).to_( be_false() );
end;
```

Expand All @@ -85,6 +92,8 @@ Usage:
```sql
begin
ut.expect( sysdate ).to_be_greater_or_equal( sysdate - 1 );
--or
ut.expect( sysdate ).to_( be_greater_or_equal( sysdate - 1 ) );
end;
```

Expand All @@ -95,6 +104,8 @@ Usage:
```sql
begin
ut.expect( 2 ).to_be_greater_than( 1 );
--or
ut.expect( 2 ).to_( be_greater_than( 1 ) );
end;
```

Expand All @@ -105,6 +116,8 @@ Usage:
```sql
begin
ut.expect( 3 ).to_be_less_or_equal( 3 );
--or
ut.expect( 3 ).to_( be_less_or_equal( 3 ) );
end;
```

Expand All @@ -115,6 +128,8 @@ Usage:
```sql
begin
ut.expect( 3 ).to_be_less_than( 2 );
--or
ut.expect( 3 ).to_( be_less_than( 2 ) );
end;
```

Expand All @@ -127,6 +142,9 @@ Usage:
begin
ut.expect( 'Lorem_impsum' ).to_be_like( a_mask => '%rem\_%', a_escape_char => '\' );
ut.expect( 'Lorem_impsum' ).to_be_like( '%rem\_%', '\' );
--or
ut.expect( 'Lorem_impsum' ).to_( be_like( a_mask => '%rem\_%', a_escape_char => '\' ) );
ut.expect( 'Lorem_impsum' ).to_( be_like( '%rem\_%', '\' ) );
end;
```

Expand All @@ -140,6 +158,10 @@ Usage:
```sql
begin
ut.expect( to_clob('ABC') ).to_be_not_null();
--or
ut.expect( to_clob('ABC') ).to_( be_not_null() );
--or
ut.expect( to_clob('ABC') ).not_to( be_null() );
end;
```

Expand All @@ -150,6 +172,8 @@ Usage:
```sql
begin
ut.expect( cast(null as varchar2(100)) ).to_be_null();
--or
ut.expect( cast(null as varchar2(100)) ).to_( be_null() );
end;
```

Expand All @@ -161,6 +185,8 @@ Usage:
```sql
begin
ut.expect( ( 1 = 1 ) ).to_be_true();
--or
ut.expect( ( 1 = 1 ) ).to_( be_true() );
end;
```

Expand All @@ -179,6 +205,9 @@ procedure check_if_cursors_are_equal is
begin
ut.expect( 'a dog' ).to_equal( 'a dog' );
ut.expect( a_actual => y ).to_equal( a_expected => x, a_nulls_are_equal => true );
--or
ut.expect( 'a dog' ).to_( equal( 'a dog' ) );
ut.expect( a_actual => y ).to_( equal( a_expected => x, a_nulls_are_equal => true ) );
end;
```
The `a_nulls_are_equal` parameter decides on the behavior of `null=null` comparison (**this comparison by default is true!**)
Expand Down Expand Up @@ -341,6 +370,9 @@ Usage:
begin
ut.expect( a_actual => '123-456-ABcd' ).to_match( a_pattern => '\d{3}-\d{3}-[a-z]', a_modifiers => 'i' );
ut.expect( 'some value' ).to_match( '^some.*' );
--or
ut.expect( a_actual => '123-456-ABcd' ).to_( match( a_pattern => '\d{3}-\d{3}-[a-z]', a_modifiers => 'i' ) );
ut.expect( 'some value' ).to_( match( '^some.*' ) );
end;
```

Expand Down Expand Up @@ -377,7 +409,7 @@ Syntax of check for matcher evaluating to true:
```sql
begin
ut.expect( a_actual {data-type} ).to_{matcher};
ut.expect( a_actual {data-type} ).to_{ (matcher} );
ut.expect( a_actual {data-type} ).to_( {matcher} );
end;
```

Expand All @@ -394,7 +426,7 @@ If a matcher evaluated to NULL, then both `to_` and `not_to` will cause the expe
Example:
```sql
begin
ut.expect( null ).to_be_true();
ut.expect( null ).to_( be_true() );
ut.expect( null ).not_to( be_true() );
end;
```
Expand Down