Files
sqltoolsservice/test/Microsoft.SqlTools.ServiceLayer.Test/Formatter/GeneralFormatterTests.cs
Kevin Cunnane 7f20f84add Avoid unnecessary indents for compount boolean expressions (#246)
- Avoid incrementing indents for compound binary boolean expressions. Multiple 'AND x = Y' statements were each indenting instead of having the same indent level.
- Fixes https://github.com/Microsoft/vscode-mssql/issues/709
2017-02-21 22:18:01 -08:00

54 lines
1.9 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.Test.Formatter
{
public class GeneralFormatterTests : FormatterUnitTestsBase
{
[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);
}
}
}