Skip to content

Commit

Permalink
Changing assert package used in tests
Browse files Browse the repository at this point in the history
Replacing obsolete project with the newer version.
Package github.com/stretchrcom/testify/assert is not developed any
more, it is replaced with github.com/stretchr/testify/assert.
  • Loading branch information
ianic committed Feb 9, 2016
1 parent 0c05c6d commit 0594db1
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 27 deletions.
2 changes: 1 addition & 1 deletion camelize_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package freetds

import (
"github.com/stretchrcom/testify/assert"
"github.com/stretchr/testify/assert"
"testing"
)

Expand Down
2 changes: 1 addition & 1 deletion conn_pool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package freetds

import (
"fmt"
"github.com/stretchrcom/testify/assert"
"github.com/stretchr/testify/assert"
"testing"
"time"
)
Expand Down
12 changes: 6 additions & 6 deletions conn_sp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"testing"
"time"

"github.com/stretchrcom/testify/assert"
"github.com/stretchr/testify/assert"
)

func TestExecSp(t *testing.T) {
Expand Down Expand Up @@ -118,11 +118,11 @@ func TestExecSpOutputParams(t *testing.T) {
assert.True(t, rst.HasOutputParams())
assert.Equal(t, len(rst.outputParams), 1)
assert.Equal(t, rst.outputParams[0].Name, "@p1")
assert.Equal(t, rst.outputParams[0].Value, 124)
assert.EqualValues(t, rst.outputParams[0].Value, 124)
var p1 int32
err = rst.ParamScan(&p1)
assert.Nil(t, err)
assert.Equal(t, p1, 124)
assert.EqualValues(t, p1, 124)
}

func TestGetSpParams(t *testing.T) {
Expand All @@ -131,10 +131,10 @@ func TestGetSpParams(t *testing.T) {
assert.Nil(t, err)
p := params[0]
assert.Equal(t, p.Name, "@p1")
assert.Equal(t, p.ParameterId, 1)
assert.Equal(t, p.UserTypeId, SYBINT4)
assert.EqualValues(t, p.ParameterId, 1)
assert.EqualValues(t, p.UserTypeId, SYBINT4)
assert.Equal(t, p.IsOutput, false)
assert.Equal(t, p.MaxLength, 4)
assert.EqualValues(t, p.MaxLength, 4)
assert.Equal(t, int(p.Precision), 0xa)
assert.Equal(t, int(p.Scale), 0x0)
}
Expand Down
8 changes: 4 additions & 4 deletions conn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"testing"
"time"

"github.com/stretchrcom/testify/assert"
"github.com/stretchr/testify/assert"
)

var CREATE_DB_SCRIPTS = [...]string{`
Expand Down Expand Up @@ -206,7 +206,7 @@ func TestSelectValue(t *testing.T) {

val, err := conn.SelectValue("select 1")
assert.Nil(t, err)
assert.Equal(t, 1, val)
assert.EqualValues(t, 1, val)

val, err = conn.SelectValue("select 1 where 1=2")
assert.NotNil(t, err)
Expand Down Expand Up @@ -313,7 +313,7 @@ func TestTransactionCommitRollback(t *testing.T) {
assert.Nil(t, err)
rows, err := conn.SelectValue("select count(*) from test_transaction")
assert.Nil(t, err)
assert.Equal(t, rows, 2)
assert.EqualValues(t, rows, 2)

//roollback
err = conn.Begin()
Expand All @@ -323,7 +323,7 @@ func TestTransactionCommitRollback(t *testing.T) {
assert.Nil(t, err)
rows, err = conn.SelectValue("select count(*) from test_transaction")
assert.Nil(t, err)
assert.Equal(t, rows, 2)
assert.EqualValues(t, rows, 2)
}

func createTestTable2(t *testing.T, conn *Conn, name string, columDef string) {
Expand Down
6 changes: 3 additions & 3 deletions convert_sql_buf_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"testing"
"time"

"github.com/stretchrcom/testify/assert"
"github.com/stretchr/testify/assert"
)

func TestInt(t *testing.T) {
Expand All @@ -27,7 +27,7 @@ func TestInt16(t *testing.T) {
data, _, err := typeToSqlBuf(SYBINT2, 32768, false)
assert.Nil(t, err)
i16 := sqlBufToType(SYBINT2, data)
assert.Equal(t, i16, -32768)
assert.EqualValues(t, i16, -32768)
//error
_, _, err = typeToSqlBuf(SYBINT2, "pero", false)
assert.NotNil(t, err)
Expand Down Expand Up @@ -110,5 +110,5 @@ func testToSqlToType(t *testing.T, typ int, value interface{}) {
data, _, err := typeToSqlBuf(typ, value, false)
assert.Nil(t, err)
value2 := sqlBufToType(typ, data)
assert.Equal(t, value, value2)
assert.EqualValues(t, value, value2)
}
2 changes: 1 addition & 1 deletion credentials_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package freetds
import (
"testing"

"github.com/stretchrcom/testify/assert"
"github.com/stretchr/testify/assert"
)

func TestParseConnectionString(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion executesql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"testing"
"time"

"github.com/stretchrcom/testify/assert"
"github.com/stretchr/testify/assert"
)

func TestGoTo2SqlDataType2(t *testing.T) {
Expand Down
15 changes: 8 additions & 7 deletions mssql_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ package freetds
import (
"database/sql"
"fmt"
"github.com/stretchrcom/testify/assert"
"strings"
"testing"

"github.com/stretchr/testify/assert"
)

func open() (*sql.DB, error) {
Expand Down Expand Up @@ -78,20 +79,20 @@ func TestLastInsertIdRowsAffected(t *testing.T) {
assert.NotNil(t, r)
id, err := r.LastInsertId()
assert.Nil(t, err)
assert.Equal(t, id, 1)
assert.EqualValues(t, id, 1)
ra, err := r.RowsAffected()
assert.Nil(t, err)
assert.Equal(t, ra, 1)
assert.EqualValues(t, ra, 1)

r, err = db.Exec("insert into test_last_insert_id values(?)", "pero")
assert.Nil(t, err)
assert.NotNil(t, r)
id, err = r.LastInsertId()
assert.Nil(t, err)
assert.Equal(t, id, 2)
assert.EqualValues(t, id, 2)
ra, err = r.RowsAffected()
assert.Nil(t, err)
assert.Equal(t, ra, 1)
assert.EqualValues(t, ra, 1)

r, err = db.Exec("update test_last_insert_id set name = ?", "jozo")
assert.Nil(t, err)
Expand All @@ -100,13 +101,13 @@ func TestLastInsertIdRowsAffected(t *testing.T) {
assert.NotNil(t, err)
ra, err = r.RowsAffected()
assert.Nil(t, err)
assert.Equal(t, ra, 2)
assert.EqualValues(t, ra, 2)

r, err = db.Exec("delete from test_last_insert_id")
assert.Nil(t, err)
ra, err = r.RowsAffected()
assert.Nil(t, err)
assert.Equal(t, ra, 2)
assert.EqualValues(t, ra, 2)
}

func createTestTable(t *testing.T, db *sql.DB, name string, columDef string) {
Expand Down
5 changes: 3 additions & 2 deletions result_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package freetds

import (
"github.com/stretchrcom/testify/assert"
"testing"
"time"

"github.com/stretchr/testify/assert"
)

var now = time.Now()
Expand Down Expand Up @@ -130,5 +131,5 @@ func TestScanTypesInStructDoesNotMatchThoseInResult(t *testing.T) {
assert.Equal(t, s.Int64, 5)

assert.Equal(t, s.Float32, 5.5)
assert.Equal(t, s.Float64, 6.5)
assert.EqualValues(t, s.Float64, 6.5)
}
2 changes: 1 addition & 1 deletion sp_result_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package freetds

import (
"github.com/stretchrcom/testify/assert"
"github.com/stretchr/testify/assert"
"testing"
)

Expand Down

0 comments on commit 0594db1

Please sign in to comment.