Pulls out aclitem[] assert func

pull/210/head
Manni Wood 2016-11-12 12:07:48 -05:00
parent 7d7bc87396
commit d9ab219753
1 changed files with 9 additions and 9 deletions

View File

@ -643,6 +643,12 @@ func TestNullX(t *testing.T) {
}
}
func assertAclItemSlicesEqual(t *testing.T, query, scan interface{}) {
if !reflect.DeepEqual(query, *(scan.(*[]pgx.AclItem))) {
t.Errorf("failed to encode aclitem[]\n EXPECTED: %v\n ACTUAL: %v", query, *(scan.(*[]pgx.AclItem)))
}
}
// XXX
func TestAclArrayDecoding(t *testing.T) {
t.Parallel()
@ -652,18 +658,12 @@ func TestAclArrayDecoding(t *testing.T) {
sql := "select $1::aclitem[]"
tests := []struct {
query interface{}
scan interface{}
assert func(*testing.T, interface{}, interface{})
query interface{}
scan interface{}
}{
{
[]pgx.AclItem{"=r/postgres"},
&[]pgx.AclItem{},
func(t *testing.T, query, scan interface{}) {
if !reflect.DeepEqual(query, *(scan.(*[]pgx.AclItem))) {
t.Errorf("failed to encode aclitem[]\n EXPECTED: %v\n ACTUAL: %v", query, *(scan.(*[]pgx.AclItem)))
}
},
},
}
for i, tt := range tests {
@ -675,7 +675,7 @@ func TestAclArrayDecoding(t *testing.T) {
}
continue
}
tt.assert(t, tt.query, tt.scan)
assertAclItemSlicesEqual(t, tt.query, tt.scan)
ensureConnValid(t, conn)
}
}