Comments (5)
Hi, @clawconduce. That would be really useful! Currently, you can do stuff like "for any set of arguments, do X". How could you do that with this kind of change? It seems like with the way go-mock works at the moment, you can either use mock.Any only for individual arguments — as you've shown above — or only for all of them as a whole — as it works now — but not both. Perhaps this is better addressed in go-mock itself by adding that capability for interface{} vararg functions? I'm interested in your thoughts.
Have you tried using mock.AnyIf? For example:
m.When("F", mock.AnyIf(func(v interface{}) bool { return v.([]interface{})[2].(string) == "test" }))
from gockle.
(Incidentally, your idea spurred me to move all the Session arguments
parameters to the end of the parameter lists for consistency and for simplicity where there are no arguments. I just pushed those changes.)
from gockle.
Good point. I can see how both cases are useful, and it's either or. I like the idea of putting something in go-mock that would cover both cases. As a bonus, it looks like it would just be adding something that would break out of this loop: https://github.com/maraino/go-mock/blob/master/mock.go#L286
from gockle.
OK, I'm going to close this issue. I see you opened a go-mock issue to continue the discussion there.
from gockle.
from gockle.
Related Issues (5)
- API closer to gocql HOT 13
- How to mock ScanMap HOT 3
- Ask for examples HOT 1
- Is there a way to get total number of query results HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gockle.