mirror of
https://github.com/neilotoole/sq.git
synced 2024-12-20 06:31:32 +03:00
65259754f5
* improvements to sqlite source metadata query * table metadatawriter colorization tuning; minor testh.Helper refactoring * cleanup of metadata for multiple drivers * more cleanup of source/table metadata * yet more cleanup of source/table metadata * improvements to mysql SourceMetadata * improvements to mysql TableMetadata * yet more fiddling with mysql metadata
30 lines
616 B
Go
30 lines
616 B
Go
package sqlite3
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
var KindFromDBTypeName = kindFromDBTypeName
|
|
var GetTblRowCounts = getTblRowCounts
|
|
|
|
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)
|
|
}
|
|
}
|