Commit 678ce976 authored by Julien Schmidt's avatar Julien Schmidt Committed by Daniel Theophanes

database/sql: fix unreachable code in ColumnTypes test

Before this change the ct == 0 check could never be true. Moreover the
values were not properly indirected.

Change-Id: Ice47e36e3492babc4b47d2f9099e8772be231c96
Reviewed-on: https://go-review.googlesource.com/68130Reviewed-by: 's avatarDaniel Theophanes <kardianos@gmail.com>
Run-TryBot: Daniel Theophanes <kardianos@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent c80338ac
......@@ -726,15 +726,15 @@ func TestRowsColumnTypes(t *testing.T) {
if err != nil {
t.Fatalf("failed to scan values in %v", err)
}
ct++
if ct == 0 {
if values[0].(string) != "Bob" {
t.Errorf("Expected Bob, got %v", values[0])
if ct == 1 {
if age := *values[0].(*int32); age != 2 {
t.Errorf("Expected 2, got %v", age)
}
if values[1].(int) != 2 {
t.Errorf("Expected 2, got %v", values[1])
if name := *values[1].(*string); name != "Bob" {
t.Errorf("Expected Bob, got %v", name)
}
}
ct++
}
if ct != 3 {
t.Errorf("expected 3 rows, got %d", ct)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment