Skip to content

Commit

Permalink
test suite refactoring
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
benbjohnson committed Jan 3, 2016
1 parent 2c56b2a commit 8b08bd4
Show file tree
Hide file tree
Showing 14 changed files with 3,337 additions and 2,057 deletions.
50 changes: 7 additions & 43 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,54 +1,18 @@
TEST=.
BENCH=.
COVERPROFILE=/tmp/c.out
BRANCH=`git rev-parse --abbrev-ref HEAD`
COMMIT=`git rev-parse --short HEAD`
GOLDFLAGS="-X main.branch $(BRANCH) -X main.commit $(COMMIT)"

default: build

bench:
go test -v -test.run=NOTHINCONTAINSTHIS -test.bench=$(BENCH)

# http://cloc.sourceforge.net/
cloc:
@cloc --not-match-f='Makefile|_test.go' .

cover: fmt
go test -coverprofile=$(COVERPROFILE) -test.run=$(TEST) $(COVERFLAG) .
go tool cover -html=$(COVERPROFILE)
rm $(COVERPROFILE)

cpuprofile: fmt
@go test -c
@./bolt.test -test.v -test.run=$(TEST) -test.cpuprofile cpu.prof
race:
@go test -v -race -test.run="TestSimulate_(100op|1000op)"

# go get github.com/kisielk/errcheck
errcheck:
@echo "=== errcheck ==="
@errcheck github.com/boltdb/bolt
@errcheck -ignorepkg=bytes -ignore=os:Remove github.com/boltdb/bolt

fmt:
@go fmt ./...

get:
@go get -d ./...

build: get
@mkdir -p bin
@go build -ldflags=$(GOLDFLAGS) -a -o bin/bolt ./cmd/bolt

test: fmt
@go get github.com/stretchr/testify/assert
@echo "=== TESTS ==="
@go test -v -cover -test.run=$(TEST)
@echo ""
@echo ""
@echo "=== CLI ==="
@go test -v -test.run=$(TEST) ./cmd/bolt
@echo ""
@echo ""
@echo "=== RACE DETECTOR ==="
@go test -v -race -test.run="TestSimulate_(100op|1000op)"
test:
@go test -v -cover .
@go test -v ./cmd/bolt

.PHONY: bench cloc cover cpuprofile fmt memprofile test
.PHONY: fmt test
138 changes: 0 additions & 138 deletions batch.go

This file was deleted.

170 changes: 0 additions & 170 deletions batch_benchmark_test.go

This file was deleted.

Loading

0 comments on commit 8b08bd4

Please sign in to comment.