Skip to content

Commit 3b34078

Browse files
improved testing output
1 parent 259c68d commit 3b34078

File tree

5 files changed

+10
-8
lines changed

5 files changed

+10
-8
lines changed

Makefile

+7-6
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,14 @@ sqlc_generate:
2020
docker run --rm -v $(ROOT_DIR):/src -w /src kjconroy/sqlc generate
2121

2222
test:
23-
go run main.go migrate_up -t| true #ignore exit 0
24-
go test ./... -p 1 -v -coverprofile cover.out
25-
@echo "================================================"
26-
@echo "Coverage"
27-
go tool cover -func cover.out
23+
@go run main.go migrate_up -t | true
24+
@sh ./test.sh
25+
@echo "================================================" | GREP_COLOR='01;33' grep -E --color '^.*=.*'
26+
@printf "\033[33mCoverage\033[0m"
27+
@echo ""
28+
@sh ./cover.sh
2829
@echo "Cleaning..."
29-
go run main.go dropdb -t
30+
@go run main.go dropdb -t
3031
# @echo "docker run --rm -v ${d}:/src -w /src kjconroy/sqlc generate"
3132
# createtestdb:
3233
# docker exec -it postgres12 createdb --username=sponge --owner=sponge twtTest

cover.sh

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
go tool cover -func cover.out | GREP_COLOR='01;32' grep -E --color 'github.*$|^.*github.*$|^.*total.*$|$ '

server/server.go

-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ func (s *Server) PrepareRouter() {
7474
}
7575

7676
func (s *Server) RunServer(host string, port int) (err error) {
77-
7877
log.Printf("Starting Server at %s:%v", host, port)
7978

8079
err = http.ListenAndServe(fmt.Sprintf("%s:%v", host, port), s.Router)

test.sh

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
go test ./... -p 1 -v -coverprofile cover.out | sed ''/PASS/s//$(printf "\033[32mPASS\033[0m")/'' | sed ''/FAIL/s//$(printf "\033[31mFAIL\033[0m")/'' | sed ''/RUN/s//$(printf "\033[33mRUN\033[0m")/'' | GREP_COLOR='01;32' grep -E --color 'ok.*$|^.*ok.*$|$'

utils/migration.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func MigrateSteps(steps int, config Config, path string) error {
4646
if err != nil {
4747
return err
4848
}
49-
fmt.Printf("Migrated %v steps", steps)
49+
fmt.Printf("Migrated %v steps \n", steps)
5050
return nil
5151
}
5252

0 commit comments

Comments
 (0)