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

Improve tests to fix copy() and catch errors when asserting #31

Merged
merged 1 commit into from
Jun 17, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions driver_test.go
Original file line number Diff line number Diff line change
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