From d1a8b6e13280d5a2115673113aa488db6e41955a Mon Sep 17 00:00:00 2001 From: go-jet Date: Fri, 19 Jul 2019 14:33:54 +0200 Subject: [PATCH] Add code coverage support. --- .circleci/config.yml | 15 +++++++++------ clause.go | 5 ----- execution/execution.go | 10 ---------- 3 files changed, 9 insertions(+), 21 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c040498..2357279 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -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 diff --git a/clause.go b/clause.go index 7603a76..43ce624 100644 --- a/clause.go +++ b/clause.go @@ -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" diff --git a/execution/execution.go b/execution/execution.go index 18b5606..86075b2 100644 --- a/execution/execution.go +++ b/execution/execution.go @@ -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)