X Tutup
The Wayback Machine - https://web.archive.org/web/20201124081306/https://github.com/utPLSQL/utPLSQL/pull/1076
Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/rework matcher #1076

Open
wants to merge 25 commits into
base: develop
from
Open

Feature/rework matcher #1076

wants to merge 25 commits into from

Conversation

@lwasylow
Copy link
Member

@lwasylow lwasylow commented Jun 7, 2020

Adding a matcher within_of.
Rework some of the compound expectation to use a pass a matcher to expectation to remove methods from ut_equal_compound.
Implements #77

lwasylow added 8 commits Jun 1, 2020
@lwasylow lwasylow requested a review from jgebal Jun 7, 2020
@jgebal
Copy link
Member

@jgebal jgebal commented Jun 10, 2020

@lwasylow - sorry for not reviewing it yet.
I'll look at it this week.

docs/userguide/expectations.md Outdated Show resolved Hide resolved
docs/userguide/expectations.md Show resolved Hide resolved
source/core/ut_utils.pkb Show resolved Hide resolved
source/core/ut_utils.pkb Outdated Show resolved Hide resolved
source/core/ut_utils.pkb Outdated Show resolved Hide resolved
source/expectations/ut_expectation_base.tpb Outdated Show resolved Hide resolved
l_result ut_equal := self;
begin
l_result.options.include.add_items(a_items);
l_result.expectation.to_(l_result );

This comment has been minimized.

@jgebal

jgebal Jun 13, 2020
Member

I think we need some sort of exception handling.
The syntax that is will work perfectly well are:

  • ut.expect( l_refcursor ).to_( equal(l_refcursor).include( ... ) );
  • ut.expect( l_refcursor ).to_equal(l_refcursor).include( ... );

It is however possible to call:
exec equal(l_refcursor).include( ...);
In this case, the code will fail dramatically even though it is possible to make a call like this.

Instead of throwing an un-handled exception we should throw a user-friendly one.
Something like:
ORA-20000 - utPLSQL matcher can only be called as part of expectation. Instead of calling equal( ... ).include( ... ); , call ut.expect( ... ).to_( equal( ... ).include( ... ) );

Not sure what exact error should be but definitely something that can help users understand their mistake.

l_result ut_equal := self;
begin
l_result.options.exclude.add_items(a_items);
l_result.expectation.to_(l_result );

This comment has been minimized.

@jgebal

jgebal Jun 13, 2020
Member

all calls to: l_result.expecatation in this type are assuming that the expectation attribute is set.

This comment has been minimized.

@jgebal

jgebal Jun 13, 2020
Member

Given the number of places this is called, it would be good to delegate exception handling to a helper procedure.

lwasylow and others added 17 commits Jun 14, 2020
Added synonym and grant for matcher
Reworked expectation to work fine with syntax `to_( matcher() )` for to_be_within.

TODO - add tests for other matchers with `to_( matcher )` and `not_to( matcher )` syntax
Reorganized code so that `be_within_pct` is only supported for `number`
Added tests for non-supported syntax
No tests
@sonarcloud
Copy link

@sonarcloud sonarcloud bot commented Jun 28, 2020

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 1 Security Hotspot to review)
Code Smell A 18 Code Smells

89.2% 89.2% Coverage
0.0% 0.0% Duplication

@pesse
Copy link
Member

@pesse pesse commented Nov 12, 2020

What's missing here? Maybe I can help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.
X Tutup