-
-
Notifications
You must be signed in to change notification settings - Fork 69
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
Abstract dependencies with effects #188
Comments
I think that should really be fine. Can you show me the rest of the code? I use abstract dependencies often. When I do, I don't use |
Thanks for getting back to me! Currently it is looking like this, class TabsControllerDelegate
{
public:
virtual ~TabsControllerDelegate () = default;
virtual bool LoadTab (const std::string & tab_name, bool animate) = 0;
};
struct LoadTabAction
{
std::string tab_name;
};
struct TabLoadedAction
{
std::string tab_name;
};
using TabsAction = std::variant<LoadTabAction, TabLoadedAction>;
using TabsEffect = lager::effect<TabsAction, lager::deps<TabsControllerDelegate &>>;
using TabsResult = std::pair<TabsModel, TabsEffect>;
TabsResult UpdateTabs (TabsModel tabs_model, TabsAction tabs_action); And being used as follows, MockDel del;
auto store = lager::make_store<TabsAction> (TabsModel {},
lager::with_manual_event_loop {},
lager::with_deps (std::ref (del)),
lager::with_reducer (UpdateTabs)); resulting in this error,
Again thanks for the help, I am sure I am doing something wrong, however when I change the dependency to something concrete I am able to build fine, so not too sure what might be going wrong. I am trying to figure out how to go about testing effects. I am not sure if this might be going in the wrong direction anyway. |
I think the problem is in the implementation of |
Hi, thanks again for the response. Things appear to be resolved when using the following, lager::with_deps (
std::reference_wrapper<TabsControllerDelegate> (tabs_controller_delegate_mock)) |
I do not think that's the issue, as that's equivalent to using |
I am currently trying to figure out how to use abstract dependencies as deps to effects (and if this is possible / a good idea...), take for example,
this results in the following error,
having read though the docs on effects I am struggling to understand why this might be an issue, any help would be really appreciated.
The text was updated successfully, but these errors were encountered: