Skip to content

Commit 04d4d0e

Browse files
authored
Merge pull request #10 from ziccardi/MOCK_ASYNC_ROUTINE
test: add the mock_async_routine
2 parents d613afc + 33011d9 commit 04d4d0e

File tree

3 files changed

+235
-1
lines changed

3 files changed

+235
-1
lines changed

Makefile

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,35 @@
11
APP_NAME=asyncroutinemanager
22

3+
MKFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
4+
PROJECT_PATH := $(patsubst %/,%,$(dir $(MKFILE_PATH)))
5+
LOCAL_BIN_PATH := $(PROJECT_PATH)/bin
6+
7+
export PATH := $(LOCAL_BIN_PATH):$(PATH)
8+
39
.PHONY: all build test clean
410

511
all: build
612

13+
MOCKGEN := $(LOCAL_BIN_PATH)/mockgen
14+
15+
.PHONY: mockgen-install
16+
mockgen-install:
17+
@GOBIN=$(LOCAL_BIN_PATH) go install go.uber.org/mock/[email protected] ;\
18+
719
ginkgo:
820
go install github.com/onsi/ginkgo/v2/ginkgo
921

1022
tools: ginkgo
1123

24+
25+
.PHONY: generate
26+
generate: mockgen-install
27+
go generate ./...
28+
1229
build:
1330
go build -o $(APP_NAME)
1431

15-
test: tools
32+
test: tools generate
1633
ginkgo -r -v
1734

1835
clean:

async_routine.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ const (
2424
var _ AsyncRoutine = (*asyncRoutine)(nil)
2525

2626
// AsyncRoutine is the public interface for managed async routines
27+
//
28+
//go:generate mockgen -source=async_routine.go -package=async -destination=mock_async_routine.go
2729
type AsyncRoutine interface {
2830
Name() string
2931
CreatedAt() time.Time

mock_async_routine.go

Lines changed: 215 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)