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