MCPcopy Create free account
hub / github.com/apache/devlake / Test_validateQuery

Function Test_validateQuery

backend/impls/dalgorm/dalgorm_test.go:26–50  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

24)
25
26func Test_validateQuery(t *testing.T) {
27 for _, target := range []string{
28 "begin",
29 " begin",
30 "begin ",
31 " begin ",
32 "begin;",
33 "begin ;",
34 "begin ; ;",
35 "BEGIN ; ;",
36 "start transaction",
37 "start transaction",
38 "START TRANSACTION",
39 "start\t\n transaction",
40 " ;; start transaction",
41 } {
42 assert.EqualError(t, validateQuery(target), "illegal invocation, use the `Begin()` method instead", "failed text: `%s`", target)
43 }
44 for _, target := range []string{
45 "select 1",
46 "update a set b = c",
47 } {
48 assert.Nil(t, validateQuery(target), "failed text: `%s`", target)
49 }
50}

Callers

nothing calls this directly

Calls 1

validateQueryFunction · 0.85

Tested by

no test coverage detected