diff options
author | Simon Frei <freisim93@gmail.com> | 2021-03-03 08:53:50 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-03 08:53:50 +0100 |
commit | 3d91f7c975a862be418afa43f5ca366f6e1dbd2b (patch) | |
tree | ce415ddd1c2d0e95c2d23efcd955ec769bee6679 /build.go | |
parent | 7945430e64d885a848887ce1a9231551067cebe7 (diff) | |
download | syncthing-3d91f7c975a862be418afa43f5ca366f6e1dbd2b.tar.gz syncthing-3d91f7c975a862be418afa43f5ca366f6e1dbd2b.zip |
lib: Use counterfeiter to mock interfaces in tests (#7375)
Diffstat (limited to 'build.go')
-rw-r--r-- | build.go | 21 |
1 files changed, 20 insertions, 1 deletions
@@ -316,6 +316,9 @@ func runCommand(cmd string, target target) { case "proto": proto() + case "testmocks": + testmocks() + case "translate": translate() @@ -862,10 +865,26 @@ func proto() { } runPrintInDir(path, "git", "checkout", dep.commit) } - runPrint(goCmd, "generate", "github.com/syncthing/syncthing/lib/...", "github.com/syncthing/syncthing/cmd/stdiscosrv") + runPrint(goCmd, "generate", "github.com/syncthing/syncthing/cmd/stdiscosrv") runPrint(goCmd, "generate", "proto/generate.go") } +func testmocks() { + runPrint(goCmd, "get", "golang.org/x/tools/cmd/goimports") + runPrint(goCmd, "get", "github.com/maxbrunsfeld/counterfeiter/v6") + args := []string{ + "generate", + "github.com/syncthing/syncthing/lib/config", + "github.com/syncthing/syncthing/lib/connections", + "github.com/syncthing/syncthing/lib/discover", + "github.com/syncthing/syncthing/lib/events", + "github.com/syncthing/syncthing/lib/logger", + "github.com/syncthing/syncthing/lib/model", + "github.com/syncthing/syncthing/lib/protocol", + } + runPrint(goCmd, args...) +} + func translate() { os.Chdir("gui/default/assets/lang") runPipe("lang-en-new.json", goCmd, "run", "../../../../script/translate.go", "lang-en.json", "../../../") |