Skip to content

Commit

Permalink
Test for empty data in multiinsert
Browse files Browse the repository at this point in the history
  • Loading branch information
xsikor committed Mar 16, 2017
1 parent f64770e commit bb5013d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func BuildMultiInsert(tbl string, cols Columns, rows Rows) (Query, error) {
)

if len(cols) == 0 || len(rows) == 0 {
return Query{}, errors.New("Rows and Cols can't be empty")
return Query{}, errors.New("rows and cols cannot be empty")
}

colCount := len(cols)
Expand Down
5 changes: 5 additions & 0 deletions helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@ func TestNewMultiInsert(t *testing.T) {
})
assert.Equal(t, "", q.Stmt)
assert.Error(t, err)

//Test empty insert
q, err = BuildMultiInsert(t, Columns{}, Rows{})
assert.Equal(t, "", q.Stmt)
assert.Error(t, err)
}

func BenchmarkNewInsert(b *testing.B) {
Expand Down

0 comments on commit bb5013d

Please sign in to comment.