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

Fix mocking of redeclared interface methods #382

Merged
merged 2 commits into from
Jun 20, 2017

Conversation

stakx
Copy link
Contributor

@stakx stakx commented Jun 20, 2017

PR #137 (commit 97a0f14) fixed a regression by changing the behavior of mock.SetupAllProperties so that read-only properties could be mocked, too. At the same time, it broke the frequent use case where a read-only property in a base interface is redeclared as a read-write property in a derived interface. Those redeclared properties would no longer be mocked correctly.

This commit reenables that scenario simply by changing the order in which properties are set up: properties in base interfaces (i.e. those furthest down the ancestor line) get set up before properties in more derived interfaces (i.e. those closer to the mocked type).

This fixes #162, #239, and #275.

Commit 97a0f14 changed the behavior of `mock.SetupAllProperties` so
that read-only properties could be mocked, too. At the same time, it
broke the frequent use case where a read-only property in a base
interface is redeclared as a read-write property in a derived inter-
face. Those redeclared properties would no longer be mocked correctly.

This commit reenables that scenario simply by changing the order in
which properties are set up: properties in base interfaces (i.e. those
furthest down the ancestor line) get set up before properties in more
derived interfaces (i.e. those closer to the mocked type).
@stakx stakx force-pushed the interface-method-overrides branch from c043f8e to 908e30e Compare June 20, 2017 21:41
@stakx stakx merged commit 65a3a06 into devlooped:develop Jun 20, 2017
@stakx stakx deleted the interface-method-overrides branch June 20, 2017 21:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant