• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..19-Feb-2021-

concurrent/H19-Feb-2021-10571

imp1/H19-Feb-2021-188

imp2/H19-Feb-2021-42

imp3/H19-Feb-2021-42

imp4/H19-Feb-2021-42

mock_user/H19-Feb-2021-440301

README.mdH A D19-Feb-2021710 2114

user.goH A D19-Feb-20212.8 KiB11569

user_test.goH A D19-Feb-20215.3 KiB198157

README.md

1# Samples
2
3This directory contains an example of a package containing a non-trivial
4interface that can be mocked with GoMock. The interesting files are:
5
6* `user.go`: Source code for the sample package, containing interfaces to be
7    mocked. This file depends on the packages named imp[1-4] for various things.
8
9* `user_test.go`: A test for the sample package, in which mocks of the
10    interfaces from `user.go` are used. This demonstrates how to create mock
11    objects, set up expectations, and so on.
12
13* `mock_user/mock_user.go`: The generated mock code. See ../gomock/matchers.go
14    for the `go:generate` command used to generate it.
15
16To run the test,
17
18```bash
19go test github.com/golang/mock/sample
20```
21