Skip to content

Commit

Permalink
add test for Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
t34-dev committed Aug 16, 2024
1 parent 577d249 commit 15fd0cf
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
10 changes: 10 additions & 0 deletions .make/test.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
test:
@mkdir -p $(DEV_DIR)/.temp
@CGO_ENABLED=0 go test \
. \
-coverprofile=$(DEV_DIR)/.temp/coverage-report.out -covermode=count
@go tool cover -html=$(DEV_DIR)/.temp/coverage-report.out -o $(DEV_DIR)/.temp/coverage-report.html
@go tool cover -func=$(DEV_DIR)/.temp/coverage-report.out


.PHONY: test
11 changes: 3 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
DEV_DIR := $(CURDIR)/.temp

include .make/tag.mk
include .make/test.mk

APP_NAME := go-text-replacer
APP_EXT := $(if $(filter Windows_NT,$(OS)),.exe)
Expand All @@ -11,12 +12,6 @@ build:
run: build
@.bin/$(APP_NAME)${APP_EXT}

test:
@mkdir -p $(DEV_DIR)/.temp
@CGO_ENABLED=0 go test \
. \
-coverprofile=$(DEV_DIR)/.temp/coverage-report.out -covermode=count
@go tool cover -html=$(DEV_DIR)/.temp/coverage-report.out -o $(DEV_DIR)/.temp/coverage-report.html
@go tool cover -func=$(DEV_DIR)/.temp/coverage-report.out

.PHONY: build run test

.PHONY: build run

0 comments on commit 15fd0cf

Please sign in to comment.