From ec4ff740c4fbab190b8b386bc93b8606842a5373 Mon Sep 17 00:00:00 2001 From: Masaaki Goshima Date: Sun, 6 Jun 2021 18:43:47 +0900 Subject: [PATCH 1/3] Move some tests to subdirectory --- cover_array_test.go => test/cover/cover_array_test.go | 0 cover_bool_test.go => test/cover/cover_bool_test.go | 0 cover_bytes_test.go => test/cover/cover_bytes_test.go | 0 cover_float32_test.go => test/cover/cover_float32_test.go | 0 cover_float64_test.go => test/cover/cover_float64_test.go | 0 cover_helper_test.go => test/cover/cover_helper_test.go | 0 cover_int16_test.go => test/cover/cover_int16_test.go | 0 cover_int32_test.go => test/cover/cover_int32_test.go | 0 cover_int64_test.go => test/cover/cover_int64_test.go | 0 cover_int8_test.go => test/cover/cover_int8_test.go | 0 cover_int_test.go => test/cover/cover_int_test.go | 0 cover_map_test.go => test/cover/cover_map_test.go | 0 .../cover/cover_marshal_json_test.go | 0 .../cover/cover_marshal_text_test.go | 0 cover_number_test.go => test/cover/cover_number_test.go | 0 cover_slice_test.go => test/cover/cover_slice_test.go | 0 cover_string_test.go => test/cover/cover_string_test.go | 0 cover_uint16_test.go => test/cover/cover_uint16_test.go | 0 cover_uint32_test.go => test/cover/cover_uint32_test.go | 0 cover_uint64_test.go => test/cover/cover_uint64_test.go | 0 cover_uint8_test.go => test/cover/cover_uint8_test.go | 0 cover_uint_test.go => test/cover/cover_uint_test.go | 0 .../example/example_marshaling_test.go | 0 example_test.go => test/example/example_test.go | 0 .../example/example_text_marshaling_test.go | 0 25 files changed, 0 insertions(+), 0 deletions(-) rename cover_array_test.go => test/cover/cover_array_test.go (100%) rename cover_bool_test.go => test/cover/cover_bool_test.go (100%) rename cover_bytes_test.go => test/cover/cover_bytes_test.go (100%) rename cover_float32_test.go => test/cover/cover_float32_test.go (100%) rename cover_float64_test.go => test/cover/cover_float64_test.go (100%) rename cover_helper_test.go => test/cover/cover_helper_test.go (100%) rename cover_int16_test.go => test/cover/cover_int16_test.go (100%) rename cover_int32_test.go => test/cover/cover_int32_test.go (100%) rename cover_int64_test.go => test/cover/cover_int64_test.go (100%) rename cover_int8_test.go => test/cover/cover_int8_test.go (100%) rename cover_int_test.go => test/cover/cover_int_test.go (100%) rename cover_map_test.go => test/cover/cover_map_test.go (100%) rename cover_marshal_json_test.go => test/cover/cover_marshal_json_test.go (100%) rename cover_marshal_text_test.go => test/cover/cover_marshal_text_test.go (100%) rename cover_number_test.go => test/cover/cover_number_test.go (100%) rename cover_slice_test.go => test/cover/cover_slice_test.go (100%) rename cover_string_test.go => test/cover/cover_string_test.go (100%) rename cover_uint16_test.go => test/cover/cover_uint16_test.go (100%) rename cover_uint32_test.go => test/cover/cover_uint32_test.go (100%) rename cover_uint64_test.go => test/cover/cover_uint64_test.go (100%) rename cover_uint8_test.go => test/cover/cover_uint8_test.go (100%) rename cover_uint_test.go => test/cover/cover_uint_test.go (100%) rename example_marshaling_test.go => test/example/example_marshaling_test.go (100%) rename example_test.go => test/example/example_test.go (100%) rename example_text_marshaling_test.go => test/example/example_text_marshaling_test.go (100%) diff --git a/cover_array_test.go b/test/cover/cover_array_test.go similarity index 100% rename from cover_array_test.go rename to test/cover/cover_array_test.go diff --git a/cover_bool_test.go b/test/cover/cover_bool_test.go similarity index 100% rename from cover_bool_test.go rename to test/cover/cover_bool_test.go diff --git a/cover_bytes_test.go b/test/cover/cover_bytes_test.go similarity index 100% rename from cover_bytes_test.go rename to test/cover/cover_bytes_test.go diff --git a/cover_float32_test.go b/test/cover/cover_float32_test.go similarity index 100% rename from cover_float32_test.go rename to test/cover/cover_float32_test.go diff --git a/cover_float64_test.go b/test/cover/cover_float64_test.go similarity index 100% rename from cover_float64_test.go rename to test/cover/cover_float64_test.go diff --git a/cover_helper_test.go b/test/cover/cover_helper_test.go similarity index 100% rename from cover_helper_test.go rename to test/cover/cover_helper_test.go diff --git a/cover_int16_test.go b/test/cover/cover_int16_test.go similarity index 100% rename from cover_int16_test.go rename to test/cover/cover_int16_test.go diff --git a/cover_int32_test.go b/test/cover/cover_int32_test.go similarity index 100% rename from cover_int32_test.go rename to test/cover/cover_int32_test.go diff --git a/cover_int64_test.go b/test/cover/cover_int64_test.go similarity index 100% rename from cover_int64_test.go rename to test/cover/cover_int64_test.go diff --git a/cover_int8_test.go b/test/cover/cover_int8_test.go similarity index 100% rename from cover_int8_test.go rename to test/cover/cover_int8_test.go diff --git a/cover_int_test.go b/test/cover/cover_int_test.go similarity index 100% rename from cover_int_test.go rename to test/cover/cover_int_test.go diff --git a/cover_map_test.go b/test/cover/cover_map_test.go similarity index 100% rename from cover_map_test.go rename to test/cover/cover_map_test.go diff --git a/cover_marshal_json_test.go b/test/cover/cover_marshal_json_test.go similarity index 100% rename from cover_marshal_json_test.go rename to test/cover/cover_marshal_json_test.go diff --git a/cover_marshal_text_test.go b/test/cover/cover_marshal_text_test.go similarity index 100% rename from cover_marshal_text_test.go rename to test/cover/cover_marshal_text_test.go diff --git a/cover_number_test.go b/test/cover/cover_number_test.go similarity index 100% rename from cover_number_test.go rename to test/cover/cover_number_test.go diff --git a/cover_slice_test.go b/test/cover/cover_slice_test.go similarity index 100% rename from cover_slice_test.go rename to test/cover/cover_slice_test.go diff --git a/cover_string_test.go b/test/cover/cover_string_test.go similarity index 100% rename from cover_string_test.go rename to test/cover/cover_string_test.go diff --git a/cover_uint16_test.go b/test/cover/cover_uint16_test.go similarity index 100% rename from cover_uint16_test.go rename to test/cover/cover_uint16_test.go diff --git a/cover_uint32_test.go b/test/cover/cover_uint32_test.go similarity index 100% rename from cover_uint32_test.go rename to test/cover/cover_uint32_test.go diff --git a/cover_uint64_test.go b/test/cover/cover_uint64_test.go similarity index 100% rename from cover_uint64_test.go rename to test/cover/cover_uint64_test.go diff --git a/cover_uint8_test.go b/test/cover/cover_uint8_test.go similarity index 100% rename from cover_uint8_test.go rename to test/cover/cover_uint8_test.go diff --git a/cover_uint_test.go b/test/cover/cover_uint_test.go similarity index 100% rename from cover_uint_test.go rename to test/cover/cover_uint_test.go diff --git a/example_marshaling_test.go b/test/example/example_marshaling_test.go similarity index 100% rename from example_marshaling_test.go rename to test/example/example_marshaling_test.go diff --git a/example_test.go b/test/example/example_test.go similarity index 100% rename from example_test.go rename to test/example/example_test.go diff --git a/example_text_marshaling_test.go b/test/example/example_text_marshaling_test.go similarity index 100% rename from example_text_marshaling_test.go rename to test/example/example_text_marshaling_test.go From ad4e03eeff92c3bd690cf2345cbf1de8bc3f4e32 Mon Sep 17 00:00:00 2001 From: Masaaki Goshima Date: Sun, 6 Jun 2021 18:44:10 +0900 Subject: [PATCH 2/3] Fix task --- .github/workflows/go.yml | 6 +++--- Makefile | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 4f4d9f7..c7c2137 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -24,13 +24,13 @@ jobs: - name: checkout uses: actions/checkout@v2 - name: simple test - run: go test -v ./ -count=1 + run: go test -v ./... -count=1 - name: test with GC pressure - run: go test -v ./ -count=1 + run: go test -v ./... -count=1 env: GOGC: 1 - name: test with race detector - run: go test -v -race ./ -count=1 + run: go test -v -race ./... -count=1 bench: name: Benchmark runs-on: ubuntu-latest diff --git a/Makefile b/Makefile index fd49bb1..70db23b 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ $(BIN_DIR): .PHONY: cover cover: - go test -coverpkg=$(COVERPKG_OPT) -coverprofile=cover.out . + go test -coverpkg=$(COVERPKG_OPT) -coverprofile=cover.out ./... .PHONY: cover-html cover-html: cover From f10809fec0f898c9d623a00a93fa80a2706faf4f Mon Sep 17 00:00:00 2001 From: Masaaki Goshima Date: Sun, 6 Jun 2021 19:29:52 +0900 Subject: [PATCH 3/3] Ignore test directory from pkgs --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 70db23b..363563a 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ PKG := github.com/goccy/go-json BIN_DIR := $(CURDIR)/bin -PKGS := $(shell go list ./... | grep -v internal/cmd) +PKGS := $(shell go list ./... | grep -v internal/cmd|grep -v test) COVER_PKGS := $(foreach pkg,$(PKGS),$(subst $(PKG),.,$(pkg))) COMMA := ,