-
-
Notifications
You must be signed in to change notification settings - Fork 1
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
mock_return_once() #7
Comments
Yeah there are still a couple of things I want to add. The problem I'm facing is that When I figure this out I also want to implement something kind of based on your original proposition where you can TEST(xmount_ok)
{
MOCK(mount)
->mock_return_once(0)
->disable_mock_once()
->mock_return_once(42)
->expect("a1", "b", "c", 0, "")->expect_return(0)
->expect("a2", "b", "c", 0, "")->expect_return(-1)->expect_errno(ENOENT)
->expect("a3", "b", "c", 0, "")->expect_return(42);
xmount("a1", "b", "c"); // return 0
xmount("a2", "b", "c"); // return -1
xmount("a3", "b", "c"); // return 42
ASSERT_EQ(MOCK(mount)->call_count, 3);
} |
And there's a similar problem for storing the arguments of every call in an array, I'm not sure about making the mocked function allocate to resize the array right in the middle of user code. I'm also trying to think about a way to make it opt-in: TEST(xmount_ok)
{
MOCK(mount)->start_watching();
xmount("a1", "b", "c");
MOCK(mount)->stop_watching();
xmount("a2", "b", "c");
MOCK(mount)->start_watching();
xmount("a3", "b", "c");
ASSERT_EQ(MOCK(mount)->calls[0].arg1, "a1");
ASSERT_EQ(MOCK(mount)->calls[1].arg1, "a3");
} |
Okay, nice. I'm evaluating some ideas in my fork on narmock. It's a combination of narmock and cmock. It currently looks like this: https://github.com/eerimoq/narmock/blob/master/tests/main.c |
These |
Hello!
In vberlier/narwhal#3 (comment) an example shows future functionality, allowing the user to specify a sequence of values to return from the mock. Are there any plans on releasing that?
The text was updated successfully, but these errors were encountered: