Skip to content

with_side_effects() should provide ability to inspect arguments passed to a mocked function #295

@Kamil2000

Description

@Kamil2000

The with_side_effects() should create the constrain that allows user to browse the arguments of a function.
This could be relatively easily achieved by just passing a second argument to a user callback.

Expected feature:
void user_callback(void* data, Arguments* args) {
// here it is possible to inspect/interact with args
}

//using cb
expect(mocked_function, with_side_effect(&user_callback, &unimportant));

Such change should be backward-compatible, because same thing
was used by GTK+ extensively:
// old code, most important thing is that gtk_main_quit
// declares no parameters, receives two
// and despite all of this works like a charm.
g_signal_connect(G_OBJECT(window), "destroy",
G_CALLBACK(gtk_main_quit), NULL);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions