Files
sqltoolsservice/test/Microsoft.SqlTools.ServiceLayer.UnitTests/Formatter/GeneralFormatterTests.cs
Kevin Cunnane 8d017368f9 Fixes #721 (#282)
- Ensure minimum of 2 newlines after GO statement
- All existing unit tests are passing, indicating this is respecting scenarios where users have comment lines after GO statements (this happens in many other tests)
2017-03-16 10:20:22 -07:00

68 lines
2.4 KiB
C#

//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
using Microsoft.SqlTools.ServiceLayer.Formatter;
using Xunit;
namespace Microsoft.SqlTools.ServiceLayer.UnitTests.Formatter
{
public class GeneralFormatterTests : FormatterUnitTestsBase
{
[Fact]
public void GoNewLineShouldBePreserved()
{
LoadAndFormatAndCompare("GoNewLineShouldBePreserved",
GetInputFile("Go.sql"),
GetBaselineFile("Go_NewlineHandling.sql"),
new FormatOptions() {
KeywordCasing = CasingOptions.Lowercase,
DatatypeCasing = CasingOptions.Uppercase,
PlaceEachReferenceOnNewLineInQueryStatements = true
},
verifyFormat: true);
}
[Fact]
public void KeywordCaseConversionUppercase()
{
LoadAndFormatAndCompare("KeywordCaseConversion",
GetInputFile("KeywordCaseConversion.sql"),
GetBaselineFile("KeywordCaseConversion_Uppercase.sql"),
new FormatOptions() { KeywordCasing = CasingOptions.Uppercase },
verifyFormat: true);
}
[Fact]
public void KeywordCaseConversionLowercase()
{
LoadAndFormatAndCompare("KeywordCaseConversion",
GetInputFile("KeywordCaseConversion.sql"),
GetBaselineFile("KeywordCaseConversion_Lowercase.sql"),
new FormatOptions() { KeywordCasing = CasingOptions.Lowercase },
verifyFormat: true);
}
[Fact]
public void SelectWithOrderByShouldCorrectlyIndent()
{
LoadAndFormatAndCompare("SelectWithOrderByShouldCorrectlyIndent",
GetInputFile("SelectWithOrderBy.sql"),
GetBaselineFile("SelectWithOrderBy_CorrectIndents.sql"),
new FormatOptions(),
verifyFormat: true);
}
[Fact]
public void SelectStatementShouldCorrectlyIndent()
{
LoadAndFormatAndCompare("SelectStatementShouldCorrectlyIndent",
GetInputFile("CreateProcedure.sql"),
GetBaselineFile("CreateProcedure_CorrectIndents.sql"),
new FormatOptions(),
verifyFormat: true);
}
}
}