MCPcopy Create free account
hub / github.com/cloudspannerecosystem/spanner-cli / TestSeparateInput

Function TestSeparateInput

separator_test.go:25–313  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

23)
24
25func TestSeparateInput(t *testing.T) {
26 for _, tt := range []struct {
27 desc string
28 input string
29 want []inputStatement
30 }{
31 {
32 desc: "single query",
33 input: `SELECT "123";`,
34 want: []inputStatement{
35 {
36 statement: `SELECT "123"`,
37 statementWithoutComments: `SELECT "123"`,
38 delim: delimiterHorizontal,
39 },
40 },
41 },
42 {
43 desc: "double queries",
44 input: `SELECT "123"; SELECT "456";`,
45 want: []inputStatement{
46 {
47 statement: `SELECT "123"`,
48 statementWithoutComments: `SELECT "123"`,
49 delim: delimiterHorizontal,
50 },
51 {
52 statement: `SELECT "456"`,
53 statementWithoutComments: `SELECT "456"`,
54 delim: delimiterHorizontal,
55 },
56 },
57 },
58 {
59 desc: "quoted identifier",
60 input: "SELECT `1`, `2`; SELECT `3`, `4`;",
61 want: []inputStatement{
62 {
63 statement: "SELECT `1`, `2`",
64 statementWithoutComments: "SELECT `1`, `2`",
65 delim: delimiterHorizontal,
66 },
67 {
68 statement: "SELECT `3`, `4`",
69 statementWithoutComments: "SELECT `3`, `4`",
70 delim: delimiterHorizontal,
71 },
72 },
73 },
74 {
75 desc: "vertical delim",
76 input: `SELECT "123"\G`,
77 want: []inputStatement{
78 {
79 statement: `SELECT "123"`,
80 statementWithoutComments: `SELECT "123"`,
81 delim: delimiterVertical,
82 },

Callers

nothing calls this directly

Calls 1

separateInputFunction · 0.85

Tested by

no test coverage detected