Skip to content
This repository has been archived by the owner on Mar 16, 2021. It is now read-only.

Commit

Permalink
Merge pull request #31 from Boostport/improve-tests
Browse files Browse the repository at this point in the history
Improve tests to fix copy() and catch errors when asserting
  • Loading branch information
F21 committed Jun 17, 2017
2 parents 5c85bfd + baa4125 commit 27b9cd3
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions driver_test.go
Expand Up @@ -229,7 +229,7 @@ func TestDataTypes(t *testing.T) {
varbinValue []byte = []byte("testtesttest")
)

copy(binValue[:], "test")
copy(binValue[:], []byte("test"))

dbt.mustExec(`UPSERT INTO `+dbt.tableName+` VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)`,
integerValue,
Expand Down Expand Up @@ -1044,7 +1044,11 @@ func TestErrorCodeParsing(t *testing.T) {
t.Error("Expected error due to selecting from non-existent table, but there was no error.")
}

resErr := err.(ResponseError)
resErr, ok := err.(ResponseError)

if !ok {
t.Fatalf("Error type was not ResponseError")
}

if resErr.ErrorCode != 1012 {
t.Errorf("Expected error code to be %d, got %d.", 1012, resErr.ErrorCode)
Expand Down

0 comments on commit 27b9cd3

Please sign in to comment.