Add code coverage support.

This commit is contained in:
go-jet 2019-07-19 14:33:54 +02:00
parent 31ec532b6d
commit d1a8b6e132
3 changed files with 9 additions and 21 deletions

View file

@ -34,10 +34,7 @@ jobs:
go get github.com/davecgh/go-spew/spew
go get github.com/jstemmer/go-junit-report
- run: mkdir -p $TEST_RESULTS/unit-tests
- run: mkdir -p $TEST_RESULTS/integration-tests
- run: go test -v 2>&1 | go-junit-report > $TEST_RESULTS/unit-tests/results.xml
go install github.com/go-jet/jet/cmd/jet
- run:
name: Waiting for Postgres to be ready
@ -51,13 +48,19 @@ jobs:
echo Failed waiting for Postgres && exit 1
- run:
name: Run integration tests
name: Init Postgres database
command: |
cd tests
go run ./init/init.go
go test -v 2>&1 | go-junit-report > $TEST_RESULTS/integration-tests/results.xml
cd ..
- run: mkdir -p $TEST_RESULTS
- run: go test -v . ./tests -coverpkg=github.com/go-jet/jet,github.com/go-jet/jet/execution/...,github.com/go-jet/jet/generator/...,github.com/go-jet/jet/internal/... -coverprofile=cover.out 2>&1 | go-junit-report > $TEST_RESULTS/results.xml
- run:
name: Upload code coverage
command: bash <(curl -s https://codecov.io/bash)
- store_artifacts: # Upload test summary for display in Artifacts: https://circleci.com/docs/2.0/artifacts/
path: /tmp/test-results
destination: raw-test-output

View file

@ -199,11 +199,6 @@ func (q *sqlBuilder) insertParametrizedArgument(arg interface{}) {
q.writeString(argPlaceholder)
}
func (q *sqlBuilder) reset() {
q.buff.Reset()
q.args = []interface{}{}
}
func argToString(value interface{}) string {
if isNil(value) {
return "NULL"

View file

@ -743,16 +743,6 @@ func (s *scanContext) typeToColumnIndex(typeName, fieldName string) int {
return index
}
func (s *scanContext) getCellValue(typeName, fieldName string) interface{} {
index := s.typeToColumnIndex(typeName, fieldName)
if index < 0 {
return nil
}
return s.rowElem(index)
}
func (s *scanContext) rowElem(index int) interface{} {
valuer, ok := s.row[index].(driver.Valuer)