File: README.md

package info (click to toggle)
golang-github-golang-mock 1.6.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bookworm-backports, forky, sid, trixie
  • size: 800 kB
  • sloc: sh: 58; makefile: 3
file content (20 lines) | stat: -rw-r--r-- 705 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# 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,

```bash
go test github.com/golang/mock/sample
```