-
Notifications
You must be signed in to change notification settings - Fork 41
Expand file tree
/
Copy pathOnly180SyntaxTests.cs
More file actions
94 lines (87 loc) · 3.81 KB
/
Copy pathOnly180SyntaxTests.cs
File metadata and controls
94 lines (87 loc) · 3.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
using Microsoft.SqlServer.TransactSql.ScriptDom;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using SqlStudio.Tests.AssemblyTools.TestCategory;
using System;
using System.Collections.Generic;
using System.IO;
namespace SqlStudio.Tests.UTSqlScriptDom
{
public partial class SqlDomTests
{
// Note: These filenames are case sensitive, make sure they match the checked-in file exactly
private static readonly ParserTest[] Only180TestInfos =
{
new ParserTest180("AutomaticIndexCompactionTests180.sql", nErrors80: 2, nErrors90: 2, nErrors100: 2, nErrors110: 2, nErrors120: 2, nErrors130: 2, nErrors140: 2, nErrors150: 2, nErrors160: 2, nErrors170: 2),
new ParserTest180("TrimFromReturnTests160.sql"),
new ParserTest180("PersistSamplePercentStatisticsTests130.sql")
};
private static readonly ParserTest[] SqlAzure180_TestInfos =
{
// Add parser tests that have Azure-specific syntax constructs
// (those that have versioning visitor implemented)
//
};
/// <summary>
/// This test runs only the graph syntax tests.
/// </summary>
[TestMethod]
[Priority(0)]
[SqlStudioTestCategory(Category.UnitTest)]
public void GraphTSql180SyntaxParserTest()
{
TSql180Parser parser = new TSql180Parser(true);
SqlScriptGenerator scriptGen = ParserTestUtils.CreateScriptGen(SqlVersion.Sql180);
foreach (ParserTest ti in GraphTestsOnly)
{
ParserTest.ParseAndVerify(parser, scriptGen, ti._scriptFilename, ti._result180);
}
// Parsing both for Azure and standalone flavors - explicitly set
// enum value to 'All'
//
parser = new TSql180Parser(true, SqlEngineType.All);
scriptGen = ParserTestUtils.CreateScriptGen(SqlVersion.Sql180);
scriptGen.Options.SqlEngineType = SqlEngineType.All;
foreach (ParserTest ti in GraphTestsOnly)
{
ParserTest.ParseAndVerify(parser, scriptGen, ti._scriptFilename, ti._result180);
}
// Explicitly ask for 'standalone' and parse
//
parser = new TSql180Parser(true, SqlEngineType.Standalone);
scriptGen = ParserTestUtils.CreateScriptGen(SqlVersion.Sql180);
scriptGen.Options.SqlEngineType = SqlEngineType.Standalone;
foreach (ParserTest ti in GraphTestsOnly)
{
ParserTest.ParseAndVerify(parser, scriptGen, ti._scriptFilename, ti._result180);
}
}
[TestMethod]
[Priority(0)]
[SqlStudioTestCategory(Category.UnitTest)]
public void TSql180SyntaxTests()
{
TSql180Parser parser = new TSql180Parser(true);
SqlScriptGenerator scriptGen = ParserTestUtils.CreateScriptGen(SqlVersion.Sql180);
foreach (ParserTest ti in Only180TestInfos)
{
ParserTest.ParseAndVerify(parser, scriptGen, ti._scriptFilename, ti._result180);
}
}
/// <summary>
/// This test runs SQL Azure syntax tests - explicit check for Azure
/// </summary>
[TestMethod]
[Priority(0)]
[SqlStudioTestCategory(Category.UnitTest)]
public void TSql180AzureOnlySyntaxTests()
{
TSql180Parser parser = new TSql180Parser(true, SqlEngineType.SqlAzure);
SqlScriptGenerator scriptGen = ParserTestUtils.CreateScriptGen(SqlVersion.Sql180);
scriptGen.Options.SqlEngineType = SqlEngineType.SqlAzure;
foreach (ParserTest ti in SqlAzure180_TestInfos)
{
ParserTest.ParseAndVerify(parser, scriptGen, ti._scriptFilename, ti._result180);
}
}
}
}