added failing test, not sure how to fix it yet

pull/54/head
Karl Seguin 2014-12-24 09:06:06 +07:00
parent 43e06f9c62
commit 8d116336c3
1 changed files with 27 additions and 0 deletions

View File

@ -821,3 +821,30 @@ func TestReadingNullByteArray(t *testing.T) {
t.Errorf("Expected 'a' to have length 0, but it was: ", len(a))
}
}
func TestReadingNullByteArrays(t *testing.T) {
conn := mustConnect(t, *defaultConnConfig)
defer closeConn(t, conn)
rows, err := conn.Query("select null::text union all select null::text")
if err != nil {
t.Fatalf("conn.Query failed: ", err)
}
count := 0
for rows.Next() {
count++
var a []byte
if err := rows.Scan(&a); err != nil {
t.Fatalf("failed to scan row", err)
}
if len(a) != 0 {
t.Errorf("Expected 'a' to have length 0, but it was: ", len(a))
}
}
if count != 2 {
t.Errorf("Expected to read 2 rows, read: ", count)
}
}