mock/sample
Cody Oss 953a5bb40e
update user mock to be in test package (#566)
Fixes: #560
2021-06-04 13:31:10 -06:00
..
concurrent fix linter errors (#552) 2021-04-23 14:45:47 -06:00
imp1 Correctly qualify names in mocked methods of foreign embedded interfaces. 2012-01-07 18:27:49 +11:00
imp2 Moved imp[1-4].go into the directory structure expected by 'go build'. 2012-01-07 11:20:50 +11:00
imp3 Moved imp[1-4].go into the directory structure expected by 'go build'. 2012-01-07 11:20:50 +11:00
imp4 Moved imp[1-4].go into the directory structure expected by 'go build'. 2012-01-07 11:20:50 +11:00
README.md update user mock to be in test package (#566) 2021-06-04 13:31:10 -06:00
mock_user_test.go update user mock to be in test package (#566) 2021-06-04 13:31:10 -06:00
user.go update user mock to be in test package (#566) 2021-06-04 13:31:10 -06:00
user_test.go update user mock to be in test package (#566) 2021-06-04 13:31:10 -06:00

README.md

Samples

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 from user.go are used. This demonstrates how to create mock objects, set up expectations, and so on.

  • mock_user_test.go: The generated mock code. See ../gomock/matchers.go for the go:generate command used to generate it.

To run the test,

go test github.com/golang/mock/sample