mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
* add sqltemplate utilities, improve tests and documentation * bunch of things * remove unnecessary message * add queries * add queries * add queries * add folders support * fix diff * fix linters * fix diff * fix linters * fix linters * fix typo * fix linters * fix linters * fix linters * several fixes * several fixes * temporarily disable k8s integration tests for Entity Server * postpone some tests * postpone documentation changes * Fix bug in create * improve error reporting * fix PostgeSQL parameters * fix MySQL sqlmode * fix MySQL-5.7 * reduce but document the number of database connection options * remove unused code and improve docs
33 lines
616 B
Go
33 lines
616 B
Go
package sqltemplate
|
|
|
|
import "testing"
|
|
|
|
func TestArgs_Arg(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
shouldBeQuestionMark := func(t *testing.T, s string) {
|
|
t.Helper()
|
|
if s != "?" {
|
|
t.Fatalf("expecting question mark, got %q", s)
|
|
}
|
|
}
|
|
|
|
a := NewArgs(MySQL)
|
|
|
|
shouldBeQuestionMark(t, a.Arg(0))
|
|
shouldBeQuestionMark(t, a.Arg(1))
|
|
shouldBeQuestionMark(t, a.Arg(2))
|
|
shouldBeQuestionMark(t, a.Arg(3))
|
|
shouldBeQuestionMark(t, a.Arg(4))
|
|
|
|
for i, arg := range a.GetArgs() {
|
|
v, ok := arg.(int)
|
|
if !ok {
|
|
t.Fatalf("unexpected value: %T(%v)", arg, arg)
|
|
}
|
|
if v != i {
|
|
t.Fatalf("unexpected int value: %v", v)
|
|
}
|
|
}
|
|
}
|