mirror of
https://github.com/dutchcoders/transfer.sh.git
synced 2025-01-15 05:00:18 +01:00
.. | ||
concurrent | ||
imp1 | ||
imp2 | ||
imp3 | ||
imp4 | ||
mock_user | ||
README.md | ||
user.go | ||
user_test.go |
This directory contains an example of a package containing a non-trivial interface that can be mocked with GoMock. The interesting files are:
-
user.go
: Source code for the sample package, containing interfaces to be mocked. This file depends on the packages named imp[1-4] for various things. -
user_test.go
: A test for the sample package, in which mocks of the interfaces fromuser.go
are used. This demonstrates how to create mock objects, set up expectations, and so on. -
mock_user/mock_user.go
: The generated mock code. See ../gomock/matchers.go for thego:generate
command used to generate it.
To run the test,
go test github.com/golang/mock/sample