@@ -84,14 +84,8 @@ func TestScriptWithEngine(t *testing.T, e QueryEngine, harness Harness, script q
84
84
require .NoError (t , err , nil )
85
85
86
86
t .Run (script .Name , func (t * testing.T ) {
87
- if sh , ok := harness .(SkippingHarness ); ok {
88
- if sh .SkipQueryTest (script .Name ) {
89
- t .Skip ()
90
- }
91
-
92
- if ! supportedDialect (harness , script .Dialect ) {
93
- t .Skip ()
94
- }
87
+ if skipScript (harness , script , false ) {
88
+ t .Skip ()
95
89
}
96
90
97
91
for _ , statement := range script .SetUpScript {
@@ -126,7 +120,7 @@ func TestScriptWithEngine(t *testing.T, e QueryEngine, harness Harness, script q
126
120
ctx = th .NewSession ()
127
121
}
128
122
129
- if skipAssertion (t , harness , assertion ) {
123
+ if skipAssertion (harness , assertion ) {
130
124
t .Skip ()
131
125
}
132
126
@@ -161,30 +155,26 @@ func TestScriptWithEngine(t *testing.T, e QueryEngine, harness Harness, script q
161
155
})
162
156
}
163
157
164
- func skipAssertion ( t * testing. T , harness Harness , assertion queries.ScriptTestAssertion ) bool {
165
- if sh , ok := harness .(SkippingHarness ); ok && sh .SkipQueryTest (assertion . Query ) {
158
+ func skipScript ( harness Harness , script queries.ScriptTest , prepared bool ) bool {
159
+ if sh , ok := harness .(SkippingHarness ); ok && sh .SkipQueryTest (script . Name ) {
166
160
return true
167
161
}
168
162
169
- if ! supportedDialect (harness , assertion .Dialect ) {
170
- return true
171
- }
163
+ return script .Skip || ! supportedDialect (harness , script .Dialect ) || (prepared && script .SkipPrepared )
164
+ }
172
165
173
- if assertion .Skip {
166
+ func skipAssertion (harness Harness , assertion queries.ScriptTestAssertion ) bool {
167
+ if sh , ok := harness .(SkippingHarness ); ok && sh .SkipQueryTest (assertion .Query ) {
174
168
return true
175
169
}
176
170
177
- return false
171
+ return assertion . Skip || ! supportedDialect ( harness , assertion . Dialect )
178
172
}
179
173
180
174
// TestScriptPrepared substitutes literals for bindvars, runs the test script given,
181
175
// and makes any assertions given
182
176
func TestScriptPrepared (t * testing.T , harness Harness , script queries.ScriptTest ) bool {
183
177
return t .Run (script .Name , func (t * testing.T ) {
184
- if script .SkipPrepared {
185
- t .Skip ()
186
- }
187
-
188
178
e := mustNewEngine (t , harness )
189
179
defer e .Close ()
190
180
TestScriptWithEnginePrepared (t , e , harness , script )
@@ -194,6 +184,10 @@ func TestScriptPrepared(t *testing.T, harness Harness, script queries.ScriptTest
194
184
// TestScriptWithEnginePrepared runs the test script with bindvars substituted for literals
195
185
// using the engine provided.
196
186
func TestScriptWithEnginePrepared (t * testing.T , e QueryEngine , harness Harness , script queries.ScriptTest ) {
187
+ if skipScript (harness , script , true ) {
188
+ t .Skip ()
189
+ }
190
+
197
191
ctx := NewContext (harness )
198
192
err := CreateNewConnectionForServerEngine (ctx , e )
199
193
require .NoError (t , err , nil )
@@ -223,13 +217,7 @@ func TestScriptWithEnginePrepared(t *testing.T, e QueryEngine, harness Harness,
223
217
224
218
for _ , assertion := range assertions {
225
219
t .Run (assertion .Query , func (t * testing.T ) {
226
-
227
- if sh , ok := harness .(SkippingHarness ); ok {
228
- if sh .SkipQueryTest (assertion .Query ) {
229
- t .Skip ()
230
- }
231
- }
232
- if assertion .Skip {
220
+ if skipAssertion (harness , assertion ) {
233
221
t .Skip ()
234
222
}
235
223
0 commit comments