2020-08-06 20:58:47 +03:00
|
|
|
package sqlite3
|
|
|
|
|
2020-08-12 21:24:01 +03:00
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
)
|
|
|
|
|
2022-12-18 11:35:59 +03:00
|
|
|
var (
|
|
|
|
KindFromDBTypeName = kindFromDBTypeName
|
|
|
|
GetTblRowCounts = getTblRowCounts
|
|
|
|
)
|
2020-08-12 21:24:01 +03:00
|
|
|
|
|
|
|
func TestPlaceholders(t *testing.T) {
|
|
|
|
testCases := []struct {
|
|
|
|
numCols int
|
|
|
|
numRows int
|
|
|
|
want string
|
|
|
|
}{
|
|
|
|
{numCols: 0, numRows: 0, want: ""},
|
|
|
|
{numCols: 1, numRows: 1, want: "(?)"},
|
|
|
|
{numCols: 2, numRows: 1, want: "(?, ?)"},
|
|
|
|
{numCols: 1, numRows: 2, want: "(?), (?)"},
|
|
|
|
{numCols: 2, numRows: 2, want: "(?, ?), (?, ?)"},
|
|
|
|
}
|
|
|
|
|
|
|
|
for _, tc := range testCases {
|
|
|
|
got := placeholders(tc.numCols, tc.numRows)
|
|
|
|
require.Equal(t, tc.want, got)
|
|
|
|
}
|
|
|
|
}
|