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

No warning or error reported for non-virtual method calls. #47

Open
staticcat opened this issue Sep 9, 2014 · 0 comments
Open

No warning or error reported for non-virtual method calls. #47

staticcat opened this issue Sep 9, 2014 · 0 comments
Labels

Comments

@staticcat
Copy link
Contributor

Currently if the following class is used for mocking;

type
    TMyClass = class(TObject)
        function NonVirtualFunc : boolean;
    end;

If the caller for TMock specifies a behavior or expectation on the NonVirtualFunc method they will not get any warning or error. Also their Verify call on the Mock will not fail as their are no registered expectations.

From what I can see this should be as simple as flagging in the Expect and Will*When calls that they were called. If the DoInvoke is not called after them then an exception is raised. This could be done on the reference release of the setup object. This shouldn't destroy the object as the Mock owns the proxy, however it should reduce the reference count by one.

This should remove an annoying bug where not having virtual declared on a method means you simply don't see the defined behavior being called.

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

No branches or pull requests

1 participant