queryx: Add test to check that all methods are wrapped
Signed-off-by: Michał Matczuk <michal@scylladb.com>
This commit is contained in:
committed by
Michal Jan Matczuk
parent
6f3b4bc8e5
commit
33e08981ad
@@ -5,8 +5,10 @@
|
||||
package gocqlx
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"github.com/gocql/gocql"
|
||||
"github.com/google/go-cmp/cmp"
|
||||
)
|
||||
|
||||
@@ -149,3 +151,25 @@ func TestQueryxBindMap(t *testing.T) {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
func TestQyeryxAllWrapped(t *testing.T) {
|
||||
var (
|
||||
gocqlQueryPtr = reflect.TypeOf((*gocql.Query)(nil))
|
||||
queryxPtr = reflect.TypeOf((*Queryx)(nil))
|
||||
)
|
||||
|
||||
for i := 0; i < gocqlQueryPtr.NumMethod(); i++ {
|
||||
m, ok := queryxPtr.MethodByName(gocqlQueryPtr.Method(i).Name)
|
||||
if !ok {
|
||||
t.Fatalf("Queryx missing method %s", gocqlQueryPtr.Method(i).Name)
|
||||
}
|
||||
|
||||
t.Log(m.Name)
|
||||
|
||||
for j := 0; j < m.Type.NumOut(); j++ {
|
||||
if m.Type.Out(j) == gocqlQueryPtr {
|
||||
t.Errorf("Queryx method %s not wrapped", m.Name)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user