Coder Social home page Coder Social logo

Possible Change about gockle HOT 5 CLOSED

willfaught avatar willfaught commented on August 21, 2024
Possible Change

from gockle.

Comments (5)

willfaught avatar willfaught commented on August 21, 2024

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.

willfaught avatar willfaught commented on August 21, 2024

(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.

clawconduce avatar clawconduce commented on August 21, 2024

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.

willfaught avatar willfaught commented on August 21, 2024

OK, I'm going to close this issue. I see you opened a go-mock issue to continue the discussion there.

from gockle.

willfaught avatar willfaught commented on August 21, 2024

See maraino/go-mock@341395f

from gockle.

Related Issues (5)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.