Skip to content

Commit

Permalink
another test
Browse files Browse the repository at this point in the history
  • Loading branch information
taniabogatsch committed Jun 20, 2024
1 parent 47baaed commit 5ee4860
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 0 additions & 2 deletions errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ const (
)

var (
errDriver = errors.New("internal driver error: please file a bug report")

errAPI = errors.New("API error")
errVectorSize = errors.New("data chunks cannot exceed duckdb's internal vector size")

Expand Down
11 changes: 9 additions & 2 deletions errors_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ func TestErrNestedMap(t *testing.T) {
}

func TestErrAppender(t *testing.T) {
t.Parallel()

t.Run(errAppenderInvalidCon.Error(), func(t *testing.T) {
var con driver.Conn
_, err := NewAppenderFromConn(con, "", "test")
Expand Down Expand Up @@ -160,6 +162,13 @@ func TestErrAppender(t *testing.T) {
require.NoError(t, con.Close())
require.NoError(t, c.Close())
})

t.Run(errUnsupportedMapKeyType.Error(), func(t *testing.T) {
c, con, a := prepareAppender(t, `CREATE TABLE test (m MAP(INT[], STRUCT(v INT)))`)
err := a.AppendRow(nil)
testError(t, err, errAppenderAppendRow.Error(), errUnsupportedMapKeyType.Error())
cleanupAppender(t, c, con, a)
})
}

func TestErrAppend(t *testing.T) {
Expand All @@ -186,10 +195,8 @@ func TestErrAppendDecimal(t *testing.T) {

func TestErrAppendEnum(t *testing.T) {
c, con, a := prepareAppender(t, testTypesEnumSQL+";"+`CREATE TABLE test (e my_enum)`)

err := a.AppendRow("3")
testError(t, err, errAppenderAppendRow.Error(), castErrMsg)

cleanupAppender(t, c, con, a)
}

Expand Down
1 change: 0 additions & 1 deletion vector.go
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,6 @@ func (vec *vector) initCString(duckdbType C.duckdb_type) {
}

func (vec *vector) initDecimal(logicalType C.duckdb_logical_type, colIdx int) error {
// Get the width and scale.
vec.width = uint8(C.duckdb_decimal_width(logicalType))
vec.scale = uint8(C.duckdb_decimal_scale(logicalType))

Expand Down

0 comments on commit 5ee4860

Please sign in to comment.