(t *testing.T)
| 24 | ) |
| 25 | |
| 26 | func 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 | } |
nothing calls this directly
no test coverage detected