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

action doesn't work on functions with arguments #10

Open
belka-ew opened this issue Jan 25, 2018 · 2 comments
Open

action doesn't work on functions with arguments #10

belka-ew opened this issue Jan 25, 2018 · 2 comments
Assignees
Labels

Comments

@belka-ew
Copy link

This code should fail, but it doesn't:

class B
{
    void foo(string[] = null)
    {
    }
}

unittest
{
    auto mocker = new Mocker;
    auto klass = mocker.mock!B;

    mocker.expect(klass.foo).action({ assert(false); });

    mocker.replay;

    klass.foo;

    mocker.verify;
}
@belka-ew belka-ew added the bug label Jan 25, 2018
@belka-ew belka-ew self-assigned this Jan 25, 2018
@belka-ew
Copy link
Author

mocker.expect(klass.foo).action((string[] = null) { assert(false); });

works as expected.

mocker.expect(klass.foo).action(delegate void(string[] = null) { assert(false); });

works as expected.

@belka-ew
Copy link
Author

    mocker.expect(klass.foo(null)).action((string[]) => { assert(false); });

doesn't fail.

Event if the passed callback has wrong signature, caller should be notified (with an exception according to the function documentation).

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