We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 50edee1 commit 1464871Copy full SHA for 1464871
driver_test.go
@@ -1916,3 +1916,36 @@ func TestInterruptBySignal(t *testing.T) {
1916
}
1917
})
1918
1919
+
1920
+func TestColumnsReusesSlice(t *testing.T) {
1921
+ rows := mysqlRows{
1922
+ rs: resultSet{
1923
+ columns: []mysqlField{
1924
+ {
1925
+ tableName: "test",
1926
+ name: "A",
1927
+ },
1928
1929
1930
+ name: "B",
1931
1932
1933
1934
+ }
1935
1936
+ allocs := testing.AllocsPerRun(1, func() {
1937
+ cols := rows.Columns()
1938
1939
+ if len(cols) != 2 {
1940
+ t.Fatalf("expected 2 columns, got %d", len(cols))
1941
1942
+ })
1943
1944
+ if allocs != 0 {
1945
+ t.Fatalf("expected 0 allocations, got %d", int(allocs))
1946
1947
1948
+ if rows.rs.columnNames == nil {
1949
+ t.Fatalf("expected columnNames to be set, got nil")
1950
1951
+}
0 commit comments