An open API service providing repository metadata for many open source software ecosystems.

Package Usage: go: github.com/stretchr/testify/mock

Package mock provides a system by which it is possible to mock your objects and verify calls are happening as expected. The mock package provides an object, Mock, that tracks activity on another object. It is usually embedded into a test object as shown below: When implementing the methods of an interface, you wire your functions up to call the Mock.Called(args...) method, and return the appropriate values. For example, to mock a method that saves the name and age of a person and returns the year of their birth or an error, you might write this: The Int, Error and Bool methods are examples of strongly typed getters that take the argument index position. Given this argument list: You could read them out strongly typed like this: For objects of your own type, use the generic Arguments.Get(index) method and make a type assertion: This may cause a panic if the object you are getting is nil (the type assertion will fail), in those cases you should check for nil first.
0 versions

View more package details: https://packages.ecosystem.code.gouv.fr/registries/proxy.golang.org/packages/github.com/stretchr/testify/mock

Dependent Repos 1

Spirals-Team/genpack-swarm Fork of docker-archive/classicswarm
GenPack is an extension of Docker Swarm to better pack containers onto hosts

Size: 12.8 MB - Last synced: 4 days ago - Pushed: over 8 years ago