@@ -9,7 +9,7 @@ public partial class SqlDomTests
9
9
// Note: These filenames are case sensitive, make sure they match the checked-in file exactly
10
10
private static readonly ParserTest [ ] Only170TestInfos =
11
11
{
12
- new ParserTest170 ( "RegexpTVFTests170.sql" , nErrors80 : 0 , nErrors90 : 0 , nErrors100 : 0 , nErrors110 : 0 , nErrors120 : 0 , nErrors130 : 0 , nErrors140 : 0 , nErrors150 : 0 , nErrors160 : 0 )
12
+ new ParserTest170 ( "RegexpTVFTests170.sql" , nErrors80 : 1 , nErrors90 : 1 , nErrors100 : 0 , nErrors110 : 0 , nErrors120 : 0 , nErrors130 : 0 , nErrors140 : 0 , nErrors150 : 0 , nErrors160 : 0 )
13
13
} ;
14
14
15
15
private static readonly ParserTest [ ] SqlAzure170_TestInfos =
@@ -19,6 +19,43 @@ public partial class SqlDomTests
19
19
//
20
20
} ;
21
21
22
+ /// <summary>
23
+ /// This test runs only the graph syntax tests.
24
+ /// </summary>
25
+ [ TestMethod ]
26
+ [ Priority ( 0 ) ]
27
+ [ SqlStudioTestCategory ( Category . UnitTest ) ]
28
+ public void GraphTSql170SyntaxParserTest ( )
29
+ {
30
+ TSql170Parser parser = new TSql170Parser ( true ) ;
31
+ SqlScriptGenerator scriptGen = ParserTestUtils . CreateScriptGen ( SqlVersion . Sql170 ) ;
32
+ foreach ( ParserTest ti in GraphTestsOnly )
33
+ {
34
+ ParserTest . ParseAndVerify ( parser , scriptGen , ti . _scriptFilename , ti . _result170 ) ;
35
+ }
36
+
37
+ // Parsing both for Azure and standalone flavors - explicitly set
38
+ // enum value to 'All'
39
+ //
40
+ parser = new TSql170Parser ( true , SqlEngineType . All ) ;
41
+ scriptGen = ParserTestUtils . CreateScriptGen ( SqlVersion . Sql170 ) ;
42
+ scriptGen . Options . SqlEngineType = SqlEngineType . All ;
43
+ foreach ( ParserTest ti in GraphTestsOnly )
44
+ {
45
+ ParserTest . ParseAndVerify ( parser , scriptGen , ti . _scriptFilename , ti . _result170 ) ;
46
+ }
47
+
48
+ // Explicitly ask for 'standalone' and parse
49
+ //
50
+ parser = new TSql170Parser ( true , SqlEngineType . Standalone ) ;
51
+ scriptGen = ParserTestUtils . CreateScriptGen ( SqlVersion . Sql170 ) ;
52
+ scriptGen . Options . SqlEngineType = SqlEngineType . Standalone ;
53
+ foreach ( ParserTest ti in GraphTestsOnly )
54
+ {
55
+ ParserTest . ParseAndVerify ( parser , scriptGen , ti . _scriptFilename , ti . _result170 ) ;
56
+ }
57
+ }
58
+
22
59
[ TestMethod ]
23
60
[ Priority ( 0 ) ]
24
61
[ SqlStudioTestCategory ( Category . UnitTest ) ]
@@ -55,5 +92,271 @@ public void TSql170SyntaxIn170ParserTest()
55
92
}
56
93
}
57
94
95
+ [ TestMethod ]
96
+ [ Priority ( 0 ) ]
97
+ [ SqlStudioTestCategory ( Category . UnitTest ) ]
98
+ public void TSql170Azure_SyntaxIn170ParserTest ( )
99
+ {
100
+ // This test checks that Azure-specific syntax constructs are successfully parsed
101
+ // with Sql170 parser pointed to Sql Azure.
102
+ //
103
+ TSql170Parser parser = new TSql170Parser ( true , SqlEngineType . SqlAzure ) ;
104
+ SqlScriptGenerator scriptGen = ParserTestUtils . CreateScriptGen ( SqlVersion . Sql170 ) ;
105
+ scriptGen . Options . SqlEngineType = SqlEngineType . SqlAzure ;
106
+ foreach ( ParserTest ti in SqlAzure170_TestInfos )
107
+ {
108
+ ParserTest . ParseAndVerify ( parser , scriptGen , ti . _scriptFilename , ti . _result170 ) ;
109
+ }
110
+ }
111
+
112
+ [ TestMethod ]
113
+ [ Priority ( 0 ) ]
114
+ [ SqlStudioTestCategory ( Category . UnitTest ) ]
115
+ public void TSql170SyntaxIn160ParserTest ( )
116
+ {
117
+ TSql150Parser parser = new TSql150Parser ( true ) ;
118
+ SqlScriptGenerator scriptGen = ParserTestUtils . CreateScriptGen ( SqlVersion . Sql160 ) ;
119
+ System . Collections . Generic . List < ParserTest > all170ParserTests = new System . Collections . Generic . List < ParserTest > ( ) ;
120
+ all170ParserTests . AddRange ( Only170TestInfos ) ;
121
+ all170ParserTests . AddRange ( SqlAzure170_TestInfos ) ;
122
+
123
+ foreach ( ParserTest ti in all170ParserTests )
124
+ {
125
+ ParserTest . ParseAndVerify ( parser , scriptGen , ti . _scriptFilename , ti . _result160 ) ;
126
+ }
127
+ }
128
+
129
+ [ TestMethod ]
130
+ [ Priority ( 0 ) ]
131
+ [ SqlStudioTestCategory ( Category . UnitTest ) ]
132
+ public void TSql170SyntaxIn150ParserTest ( )
133
+ {
134
+ TSql150Parser parser = new TSql150Parser ( true ) ;
135
+ SqlScriptGenerator scriptGen = ParserTestUtils . CreateScriptGen ( SqlVersion . Sql150 ) ;
136
+ System . Collections . Generic . List < ParserTest > all170ParserTests = new System . Collections . Generic . List < ParserTest > ( ) ;
137
+ all170ParserTests . AddRange ( Only170TestInfos ) ;
138
+ all170ParserTests . AddRange ( SqlAzure170_TestInfos ) ;
139
+
140
+ foreach ( ParserTest ti in all170ParserTests )
141
+ {
142
+ ParserTest . ParseAndVerify ( parser , scriptGen , ti . _scriptFilename , ti . _result150 ) ;
143
+ }
144
+ }
145
+
146
+ [ TestMethod ]
147
+ [ Priority ( 0 ) ]
148
+ [ SqlStudioTestCategory ( Category . UnitTest ) ]
149
+ public void TSql170SyntaxIn140ParserTest ( )
150
+ {
151
+ TSql140Parser parser = new TSql140Parser ( true ) ;
152
+ SqlScriptGenerator scriptGen = ParserTestUtils . CreateScriptGen ( SqlVersion . Sql140 ) ;
153
+ System . Collections . Generic . List < ParserTest > all170ParserTests = new System . Collections . Generic . List < ParserTest > ( ) ;
154
+ all170ParserTests . AddRange ( Only170TestInfos ) ;
155
+ all170ParserTests . AddRange ( SqlAzure170_TestInfos ) ;
156
+
157
+ foreach ( ParserTest ti in all170ParserTests )
158
+ {
159
+ ParserTest . ParseAndVerify ( parser , scriptGen , ti . _scriptFilename , ti . _result140 ) ;
160
+ }
161
+ }
162
+
163
+ [ TestMethod ]
164
+ [ Priority ( 0 ) ]
165
+ [ SqlStudioTestCategory ( Category . UnitTest ) ]
166
+ public void TSql170SyntaxIn130ParserTest ( )
167
+ {
168
+ TSql130Parser parser = new TSql130Parser ( true ) ;
169
+ SqlScriptGenerator scriptGen = ParserTestUtils . CreateScriptGen ( SqlVersion . Sql130 ) ;
170
+ System . Collections . Generic . List < ParserTest > all170ParserTests = new System . Collections . Generic . List < ParserTest > ( ) ;
171
+ all170ParserTests . AddRange ( Only170TestInfos ) ;
172
+ all170ParserTests . AddRange ( SqlAzure170_TestInfos ) ;
173
+
174
+ foreach ( ParserTest ti in all170ParserTests )
175
+ {
176
+ ParserTest . ParseAndVerify ( parser , scriptGen , ti . _scriptFilename , ti . _result130 ) ;
177
+ }
178
+ }
179
+
180
+ [ TestMethod ]
181
+ [ Priority ( 0 ) ]
182
+ [ SqlStudioTestCategory ( Category . UnitTest ) ]
183
+ public void TSql170SyntaxIn120ParserTest ( )
184
+ {
185
+ TSql120Parser parser = new TSql120Parser ( true ) ;
186
+ SqlScriptGenerator scriptGen = ParserTestUtils . CreateScriptGen ( SqlVersion . Sql120 ) ;
187
+ System . Collections . Generic . List < ParserTest > all170ParserTests = new System . Collections . Generic . List < ParserTest > ( ) ;
188
+ all170ParserTests . AddRange ( Only170TestInfos ) ;
189
+ all170ParserTests . AddRange ( SqlAzure170_TestInfos ) ;
190
+
191
+ foreach ( ParserTest ti in all170ParserTests )
192
+ {
193
+ ParserTest . ParseAndVerify ( parser , scriptGen , ti . _scriptFilename , ti . _result120 ) ;
194
+ }
195
+ }
196
+
197
+ [ TestMethod ]
198
+ [ Priority ( 0 ) ]
199
+ [ SqlStudioTestCategory ( Category . UnitTest ) ]
200
+ public void TSql170SyntaxIn110ParserTest ( )
201
+ {
202
+ TSql110Parser parser = new TSql110Parser ( true ) ;
203
+ SqlScriptGenerator scriptGen = ParserTestUtils . CreateScriptGen ( SqlVersion . Sql110 ) ;
204
+ System . Collections . Generic . List < ParserTest > all170ParserTests = new System . Collections . Generic . List < ParserTest > ( ) ;
205
+ all170ParserTests . AddRange ( Only170TestInfos ) ;
206
+ all170ParserTests . AddRange ( SqlAzure170_TestInfos ) ;
207
+
208
+ foreach ( ParserTest ti in all170ParserTests )
209
+ {
210
+ ParserTest . ParseAndVerify ( parser , scriptGen , ti . _scriptFilename , ti . _result110 ) ;
211
+ }
212
+ }
213
+
214
+ [ TestMethod ]
215
+ [ Priority ( 0 ) ]
216
+ [ SqlStudioTestCategory ( Category . UnitTest ) ]
217
+ public void TSql170SyntaxIn100ParserTest ( )
218
+ {
219
+ TSql100Parser parser = new TSql100Parser ( true ) ;
220
+ SqlScriptGenerator scriptGen = ParserTestUtils . CreateScriptGen ( SqlVersion . Sql100 ) ;
221
+ System . Collections . Generic . List < ParserTest > all170ParserTests = new System . Collections . Generic . List < ParserTest > ( ) ;
222
+ all170ParserTests . AddRange ( Only170TestInfos ) ;
223
+ all170ParserTests . AddRange ( SqlAzure170_TestInfos ) ;
224
+
225
+ foreach ( ParserTest ti in all170ParserTests )
226
+ {
227
+ ParserTest . ParseAndVerify ( parser , scriptGen , ti . _scriptFilename , ti . _result100 ) ;
228
+ }
229
+ }
230
+
231
+ [ TestMethod ]
232
+ [ Priority ( 0 ) ]
233
+ [ SqlStudioTestCategory ( Category . UnitTest ) ]
234
+ public void TSql170SyntaxIn90ParserTest ( )
235
+ {
236
+ TSql90Parser parser = new TSql90Parser ( true ) ;
237
+ SqlScriptGenerator scriptGen = ParserTestUtils . CreateScriptGen ( SqlVersion . Sql90 ) ;
238
+ System . Collections . Generic . List < ParserTest > all170ParserTests = new System . Collections . Generic . List < ParserTest > ( ) ;
239
+ all170ParserTests . AddRange ( Only170TestInfos ) ;
240
+ all170ParserTests . AddRange ( SqlAzure170_TestInfos ) ;
241
+
242
+ foreach ( ParserTest ti in all170ParserTests )
243
+ {
244
+ ParserTest . ParseAndVerify ( parser , scriptGen , ti . _scriptFilename , ti . _result90 ) ;
245
+ }
246
+ }
247
+
248
+ [ TestMethod ]
249
+ [ Priority ( 0 ) ]
250
+ [ SqlStudioTestCategory ( Category . UnitTest ) ]
251
+ public void TSql170SyntaxIn80ParserTest ( )
252
+ {
253
+ TSql80Parser parser = new TSql80Parser ( true ) ;
254
+ SqlScriptGenerator scriptGen = ParserTestUtils . CreateScriptGen ( SqlVersion . Sql80 ) ;
255
+ System . Collections . Generic . List < ParserTest > all170ParserTests = new System . Collections . Generic . List < ParserTest > ( ) ;
256
+ all170ParserTests . AddRange ( Only170TestInfos ) ;
257
+ all170ParserTests . AddRange ( SqlAzure170_TestInfos ) ;
258
+
259
+ foreach ( ParserTest ti in all170ParserTests )
260
+ {
261
+ ParserTest . ParseAndVerify ( parser , scriptGen , ti . _scriptFilename , ti . _result80 ) ;
262
+ }
263
+ }
264
+
265
+ /// <summary>
266
+ /// Let's make sure the older syntax tests still pass in the new parser
267
+ /// </summary>
268
+ [ TestMethod ]
269
+ [ Priority ( 0 ) ]
270
+ [ SqlStudioTestCategory ( Category . UnitTest ) ]
271
+ public void TSql160SyntaxIn170ParserTest ( )
272
+ {
273
+ TSql170Parser parser = new TSql170Parser ( true , SqlEngineType . Standalone ) ;
274
+ SqlScriptGenerator scriptGen = ParserTestUtils . CreateScriptGen ( SqlVersion . Sql160 ) ;
275
+ foreach ( ParserTest ti in Only140TestInfos )
276
+ {
277
+ ParserTest . ParseAndVerify ( parser , scriptGen , ti . _scriptFilename , ti . _result160 ) ;
278
+ }
279
+ }
280
+
281
+ [ TestMethod ]
282
+ [ Priority ( 0 ) ]
283
+ [ SqlStudioTestCategory ( Category . UnitTest ) ]
284
+ public void TSql150SyntaxIn170ParserTest ( )
285
+ {
286
+ TSql170Parser parser = new TSql170Parser ( true , SqlEngineType . Standalone ) ;
287
+ SqlScriptGenerator scriptGen = ParserTestUtils . CreateScriptGen ( SqlVersion . Sql150 ) ;
288
+ foreach ( ParserTest ti in Only140TestInfos )
289
+ {
290
+ ParserTest . ParseAndVerify ( parser , scriptGen , ti . _scriptFilename , ti . _result150 ) ;
291
+ }
292
+ }
293
+
294
+ [ TestMethod ]
295
+ [ Priority ( 0 ) ]
296
+ [ SqlStudioTestCategory ( Category . UnitTest ) ]
297
+ public void TSql140SyntaxIn170ParserTest ( )
298
+ {
299
+ TSql170Parser parser = new TSql170Parser ( true , SqlEngineType . Standalone ) ;
300
+ SqlScriptGenerator scriptGen = ParserTestUtils . CreateScriptGen ( SqlVersion . Sql140 ) ;
301
+ foreach ( ParserTest ti in Only140TestInfos )
302
+ {
303
+ ParserTest . ParseAndVerify ( parser , scriptGen , ti . _scriptFilename , ti . _result140 ) ;
304
+ }
305
+ }
306
+
307
+ /// <summary>
308
+ /// Let's make sure the older syntax tests still pass in the new parser
309
+ /// </summary>
310
+ [ TestMethod ]
311
+ [ Priority ( 0 ) ]
312
+ [ SqlStudioTestCategory ( Category . UnitTest ) ]
313
+ public void TSql130SyntaxIn170ParserTest ( )
314
+ {
315
+ TSql170Parser parser = new TSql170Parser ( true , SqlEngineType . Standalone ) ;
316
+ SqlScriptGenerator scriptGen = ParserTestUtils . CreateScriptGen ( SqlVersion . Sql130 ) ;
317
+ foreach ( ParserTest ti in Only130TestInfos )
318
+ {
319
+ ParserTest . ParseAndVerify ( parser , scriptGen , ti . _scriptFilename , ti . _result130 ) ;
320
+ }
321
+ }
322
+
323
+ [ TestMethod ]
324
+ [ Priority ( 0 ) ]
325
+ [ SqlStudioTestCategory ( Category . UnitTest ) ]
326
+ public void TSql120SyntaxIn170ParserTest ( )
327
+ {
328
+ TSql170Parser parser = new TSql170Parser ( true ) ;
329
+ SqlScriptGenerator scriptGen = ParserTestUtils . CreateScriptGen ( SqlVersion . Sql120 ) ;
330
+ foreach ( ParserTest ti in Only120TestInfos )
331
+ {
332
+ ParserTest . ParseAndVerify ( parser , scriptGen , ti . _scriptFilename , ti . _result120 ) ;
333
+ }
334
+ }
335
+
336
+ [ TestMethod ]
337
+ [ Priority ( 0 ) ]
338
+ [ SqlStudioTestCategory ( Category . UnitTest ) ]
339
+ public void TSql110SyntaxIn170ParserTest ( )
340
+ {
341
+ TSql170Parser parser = new TSql170Parser ( true ) ;
342
+ SqlScriptGenerator scriptGen = ParserTestUtils . CreateScriptGen ( SqlVersion . Sql110 ) ;
343
+ foreach ( ParserTest ti in Only110TestInfos )
344
+ {
345
+ ParserTest . ParseAndVerify ( parser , scriptGen , ti . _scriptFilename , ti . _result110 ) ;
346
+ }
347
+ }
348
+
349
+ [ TestMethod ]
350
+ [ Priority ( 0 ) ]
351
+ [ SqlStudioTestCategory ( Category . UnitTest ) ]
352
+ public void TSql100SyntaxIn170ParserTest ( )
353
+ {
354
+ TSql170Parser parser = new TSql170Parser ( true ) ;
355
+ SqlScriptGenerator scriptGen = ParserTestUtils . CreateScriptGen ( SqlVersion . Sql100 ) ;
356
+ foreach ( ParserTest ti in Only100TestInfos )
357
+ {
358
+ ParserTest . ParseAndVerify ( parser , scriptGen , ti . _scriptFilename , ti . _result100 ) ;
359
+ }
360
+ }
58
361
}
59
362
}
0 commit comments