@@ -87,6 +87,10 @@ func TestScriptWithEngine(t *testing.T, e QueryEngine, harness Harness, script q
8787 if sh .SkipQueryTest (script .Name ) {
8888 t .Skip ()
8989 }
90+
91+ if ! supportedDialect (harness , script .Dialect ) {
92+ t .Skip ()
93+ }
9094 }
9195
9296 for _ , statement := range script .SetUpScript {
@@ -95,6 +99,7 @@ func TestScriptWithEngine(t *testing.T, e QueryEngine, harness Harness, script q
9599 t .Skip ()
96100 }
97101 }
102+
98103 ctx = ctx .WithQuery (statement )
99104 RunQueryWithContext (t , e , harness , ctx , statement )
100105 }
@@ -120,10 +125,7 @@ func TestScriptWithEngine(t *testing.T, e QueryEngine, harness Harness, script q
120125 ctx = th .NewSession ()
121126 }
122127
123- if sh , ok := harness .(SkippingHarness ); ok && sh .SkipQueryTest (assertion .Query ) {
124- t .Skip ()
125- }
126- if assertion .Skip {
128+ if skipAssertion (t , harness , assertion ) {
127129 t .Skip ()
128130 }
129131
@@ -158,6 +160,22 @@ func TestScriptWithEngine(t *testing.T, e QueryEngine, harness Harness, script q
158160 })
159161}
160162
163+ func skipAssertion (t * testing.T , harness Harness , assertion queries.ScriptTestAssertion ) bool {
164+ if sh , ok := harness .(SkippingHarness ); ok && sh .SkipQueryTest (assertion .Query ) {
165+ return true
166+ }
167+
168+ if ! supportedDialect (harness , assertion .Dialect ) {
169+ return true
170+ }
171+
172+ if assertion .Skip {
173+ return true
174+ }
175+
176+ return false
177+ }
178+
161179// TestScriptPrepared substitutes literals for bindvars, runs the test script given,
162180// and makes any assertions given
163181func TestScriptPrepared (t * testing.T , harness Harness , script queries.ScriptTest ) bool {
@@ -1113,6 +1131,11 @@ func RunWriteQueryTestWithEngine(t *testing.T, harness Harness, e QueryEngine, t
11131131 t .Skip ()
11141132 }
11151133 }
1134+
1135+ if ! supportedDialect (harness , tt .Dialect ) {
1136+ t .Skip ()
1137+ }
1138+
11161139 ctx := NewContext (harness )
11171140 TestQueryWithContext (t , ctx , e , harness , tt .WriteQuery , tt .ExpectedWriteResult , nil , nil , nil )
11181141 expectedSelect := tt .ExpectedSelect
@@ -1122,6 +1145,18 @@ func RunWriteQueryTestWithEngine(t *testing.T, harness Harness, e QueryEngine, t
11221145 TestQueryWithContext (t , ctx , e , harness , tt .SelectQuery , expectedSelect , nil , nil , nil )
11231146}
11241147
1148+ func supportedDialect (harness Harness , dialect string ) bool {
1149+ if dialect == "" {
1150+ return true
1151+ }
1152+
1153+ harnessDialect := "mysql"
1154+ if hd , ok := harness .(DialectHarness ); ok {
1155+ harnessDialect = hd .Dialect ()
1156+ }
1157+ return harnessDialect == dialect
1158+ }
1159+
11251160func runWriteQueryTestPrepared (t * testing.T , harness Harness , tt queries.WriteQueryTest ) {
11261161 t .Run (tt .WriteQuery , func (t * testing.T ) {
11271162 if tt .Skip {
0 commit comments