Skip to content
This repository was archived by the owner on Mar 9, 2019. It is now read-only.

Commit 8b08bd4

Browse files
committed
test suite refactoring
This commit refactors the test suite to make it cleaner and to use the standard testing library better. The `assert()`, `equals()`, and `ok()` functions have been removed and some test names have been changed for clarity. No functionality has been changed.
1 parent 2c56b2a commit 8b08bd4

14 files changed

+3337
-2057
lines changed

Makefile

+7-43
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,18 @@
1-
TEST=.
2-
BENCH=.
3-
COVERPROFILE=/tmp/c.out
41
BRANCH=`git rev-parse --abbrev-ref HEAD`
52
COMMIT=`git rev-parse --short HEAD`
63
GOLDFLAGS="-X main.branch $(BRANCH) -X main.commit $(COMMIT)"
74

85
default: build
96

10-
bench:
11-
go test -v -test.run=NOTHINCONTAINSTHIS -test.bench=$(BENCH)
12-
13-
# http://cloc.sourceforge.net/
14-
cloc:
15-
@cloc --not-match-f='Makefile|_test.go' .
16-
17-
cover: fmt
18-
go test -coverprofile=$(COVERPROFILE) -test.run=$(TEST) $(COVERFLAG) .
19-
go tool cover -html=$(COVERPROFILE)
20-
rm $(COVERPROFILE)
21-
22-
cpuprofile: fmt
23-
@go test -c
24-
@./bolt.test -test.v -test.run=$(TEST) -test.cpuprofile cpu.prof
7+
race:
8+
@go test -v -race -test.run="TestSimulate_(100op|1000op)"
259

2610
# go get github.com/kisielk/errcheck
2711
errcheck:
28-
@echo "=== errcheck ==="
29-
@errcheck github.com/boltdb/bolt
12+
@errcheck -ignorepkg=bytes -ignore=os:Remove github.com/boltdb/bolt
3013

31-
fmt:
32-
@go fmt ./...
33-
34-
get:
35-
@go get -d ./...
36-
37-
build: get
38-
@mkdir -p bin
39-
@go build -ldflags=$(GOLDFLAGS) -a -o bin/bolt ./cmd/bolt
40-
41-
test: fmt
42-
@go get github.com/stretchr/testify/assert
43-
@echo "=== TESTS ==="
44-
@go test -v -cover -test.run=$(TEST)
45-
@echo ""
46-
@echo ""
47-
@echo "=== CLI ==="
48-
@go test -v -test.run=$(TEST) ./cmd/bolt
49-
@echo ""
50-
@echo ""
51-
@echo "=== RACE DETECTOR ==="
52-
@go test -v -race -test.run="TestSimulate_(100op|1000op)"
14+
test:
15+
@go test -v -cover .
16+
@go test -v ./cmd/bolt
5317

54-
.PHONY: bench cloc cover cpuprofile fmt memprofile test
18+
.PHONY: fmt test

batch.go

-138
This file was deleted.

batch_benchmark_test.go

-170
This file was deleted.

0 commit comments

Comments
 (0)