Skip to content

Commit

Permalink
Merge pull request #146 from doug-martin/gh_actions
Browse files Browse the repository at this point in the history
Add github actions
  • Loading branch information
doug-martin authored Aug 24, 2019
2 parents 8d914fd + 8e51945 commit 861d419
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 21 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Go
on:
push:
branches: # Array of patterns that match refs/heads
- master # Push events on master branch
- releases/* # Push events to branches matching refs/heads/releases/*
pull_request: # Specify a second event with pattern matching
jobs:
test:
name: Test go ${{ matrix.go_version }}
runs-on: ubuntu-latest
strategy:
matrix:
go_version: ["1.10", "1.11", "latest"]
steps:
- name: checkout
uses: actions/checkout@v1
- name: Test
env:
GO_VERSION: ${{ matrix.go_version }}
run: docker-compose run goqu-coverage
- name: Upload coverage to Codecov
run: bash <(curl -s https://codecov.io/bash) -n $GO_VERSION -e GO_VERSION,GITHUB_WORKFLOW,GITHUB_ACTION
env:
CODECOV_TOKEN: ${{secrets.CODECOV_TOKEN}}
GO_VERSION: ${{ matrix.go_version }}
21 changes: 0 additions & 21 deletions .travis.yml

This file was deleted.

60 changes: 60 additions & 0 deletions goqu_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package goqu

import (
"testing"

"github.com/DATA-DOG/go-sqlmock"
"github.com/stretchr/testify/suite"
)

type (
dialectWrapperSuite struct {
suite.Suite
}
)

func (dws *dialectWrapperSuite) SetupSuite() {
testDialect := DefaultDialectOptions()
// override to some value to ensure correct dialect is set
RegisterDialect("test", testDialect)
}

func (dws *dialectWrapperSuite) TearDownSuite() {
DeregisterDialect("test")
}

func (dws *dialectWrapperSuite) TestFrom() {
dw := Dialect("test")
dws.Equal(From("table").WithDialect("test"), dw.From("table"))
}

func (dws *dialectWrapperSuite) TestSelect() {
dw := Dialect("test")
dws.Equal(Select("col").WithDialect("test"), dw.Select("col"))
}

func (dws *dialectWrapperSuite) TestInsert() {
dw := Dialect("test")
dws.Equal(Insert("table").WithDialect("test"), dw.Insert("table"))
}

func (dws *dialectWrapperSuite) TestDelete() {
dw := Dialect("test")
dws.Equal(Delete("table").WithDialect("test"), dw.Delete("table"))
}

func (dws *dialectWrapperSuite) TestTruncate() {
dw := Dialect("test")
dws.Equal(Truncate("table").WithDialect("test"), dw.Truncate("table"))
}

func (dws *dialectWrapperSuite) TestDB() {
mDb, _, err := sqlmock.New()
dws.Require().NoError(err)
dw := Dialect("test")
dws.Equal(New("test", mDb), dw.DB(mDb))
}

func TestDialectWrapper(t *testing.T) {
suite.Run(t, new(dialectWrapperSuite))
}

0 comments on commit 861d419

Please sign in to comment.