sq/libsq/query_args_test.go
Neil O'Toole bfd5542f75
Refactor/introduce query context (#174)
* Moved query_X_test.go from /drivers to /libsq

* Refactor: introduced libsq.QueryContext type
2023-04-01 03:48:24 -06:00

35 lines
747 B
Go

package libsq_test
import (
"testing"
"github.com/neilotoole/sq/drivers/mysql"
"github.com/neilotoole/sq/libsq/source"
_ "github.com/mattn/go-sqlite3"
"github.com/neilotoole/sq/testh/sakila"
)
//nolint:exhaustive
func TestQuery_args(t *testing.T) {
testCases := []queryTestCase{
{
name: "cols",
in: `@sakila | .actor | .$a`,
args: map[string]string{"a": "first_name"},
wantSQL: `SELECT "first_name", "last_name" FROM "actor"`,
override: map[source.Type]string{mysql.Type: "SELECT `first_name`, `last_name` FROM `actor`"},
wantRecs: sakila.TblActorCount,
skip: true,
},
}
for _, tc := range testCases {
tc := tc
t.Run(tc.name, func(t *testing.T) {
execQueryTestCase(t, tc)
})
}
}