Add missing batch API (#325)
Some of gocql.Batch API are not present in the gocqlx.Batch. We need to have them implemented and have a test to make sure no API has forgotten.
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
package gocqlx_test
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/gocql/gocql"
|
||||
@@ -189,3 +190,23 @@ func TestBatch(t *testing.T) {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func TestBatchAllWrapped(t *testing.T) {
|
||||
var (
|
||||
gocqlType = reflect.TypeOf((*gocql.Batch)(nil))
|
||||
gocqlxType = reflect.TypeOf((*gocqlx.Batch)(nil))
|
||||
)
|
||||
|
||||
for i := 0; i < gocqlType.NumMethod(); i++ {
|
||||
m, ok := gocqlxType.MethodByName(gocqlType.Method(i).Name)
|
||||
if !ok {
|
||||
t.Fatalf("Batch missing method %s", gocqlType.Method(i).Name)
|
||||
}
|
||||
|
||||
for j := 0; j < m.Type.NumOut(); j++ {
|
||||
if m.Type.Out(j) == gocqlType {
|
||||
t.Errorf("Batch method %s not wrapped", m.Name)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user