MCPcopy Index your code
hub / github.com/upper/db / TestPlaceholderArray

Function TestPlaceholderArray

internal/sqlbuilder/placeholder_test.go:94–119  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

92}
93
94func TestPlaceholderArray(t *testing.T) {
95 {
96 ret, _ := Preprocess("?, ?, ?", []interface{}{1, 2, []interface{}{3, 4, 5}})
97 assert.Equal(t, "?, ?, (?, ?, ?)", ret)
98 }
99
100 {
101 ret, _ := Preprocess("?, ?, ?", []interface{}{[]interface{}{1, 2, 3}, 4, 5})
102 assert.Equal(t, "(?, ?, ?), ?, ?", ret)
103 }
104
105 {
106 ret, _ := Preprocess("?, ?, ?", []interface{}{1, []interface{}{2, 3, 4}, 5})
107 assert.Equal(t, "?, (?, ?, ?), ?", ret)
108 }
109
110 {
111 ret, _ := Preprocess("???", []interface{}{1, []interface{}{2, 3, 4}, 5})
112 assert.Equal(t, "?(?, ?, ?)?", ret)
113 }
114
115 {
116 ret, _ := Preprocess("??", []interface{}{[]interface{}{1, 2, 3}, []interface{}{}, []interface{}{4, 5}, []interface{}{}})
117 assert.Equal(t, "(?, ?, ?)(NULL)", ret)
118 }
119}
120
121func TestPlaceholderArguments(t *testing.T) {
122 {

Callers

nothing calls this directly

Calls 1

PreprocessFunction · 0.85

Tested by

no test coverage detected