mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-14 01:25:40 -05:00
Make nullable warnings a per file opt-in (#1842)
* Make nullable warnings a per file opt-in * Remove unneeded compiler directives * Remove compiler directive for User Data
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
//
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.SqlTools.ServiceLayer.Utility.SqlScriptFormatters;
|
||||
@@ -35,8 +37,8 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.UtilityTests
|
||||
yield return new object[] { "[escaped].mixed", new[] { "escaped", "mixed" } };
|
||||
yield return new object[] { "dbo.[[].weird", new[] { "dbo", "[", "weird" } };
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
[TestCaseSource(nameof(DecodeMultipartIdentifierTestData))]
|
||||
public void DecodeMultipartIdentifierTest(string input, string[] output)
|
||||
@@ -48,8 +50,8 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.UtilityTests
|
||||
Assert.AreEqual(output, decoded);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
[Test]
|
||||
|
||||
public void DecodeMultipartIdentifierFailTest([Values(
|
||||
"[bracket]closed",
|
||||
"[bracket][closed",
|
||||
@@ -60,12 +62,12 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.UtilityTests
|
||||
// If: I decode an invalid input
|
||||
// Then: It should throw an exception
|
||||
Assert.Throws<FormatException>(() => FromSqlScript.DecodeMultipartIdentifier(input));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private static readonly object[] unescaped =
|
||||
{
|
||||
|
||||
private static readonly object[] unescaped =
|
||||
{
|
||||
new object[] {"(0)", "0" },
|
||||
new object[] {"((0))", "0" },
|
||||
new object[] {"('')", "" },
|
||||
@@ -73,7 +75,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.UtilityTests
|
||||
new object[] {"(N'')", "" },
|
||||
new object[] {"(N'stuff')", "stuff" },
|
||||
new object[] {"('''stuff')", "'stuff" },
|
||||
new object[] {"(N'stu''''ff')", "stu''ff" },
|
||||
new object[] {"(N'stu''''ff')", "stu''ff" },
|
||||
};
|
||||
|
||||
[Test, TestCaseSource(nameof(unescaped))]
|
||||
@@ -82,8 +84,8 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.UtilityTests
|
||||
Assert.AreEqual(output, FromSqlScript.UnwrapLiteral(input));
|
||||
}
|
||||
|
||||
private static readonly object[] bracketed =
|
||||
{
|
||||
private static readonly object[] bracketed =
|
||||
{
|
||||
new object[] {"[name]", true },
|
||||
new object[] {"[ name ]", true },
|
||||
new object[] {"[na[[]me]", true },
|
||||
@@ -93,7 +95,7 @@ namespace Microsoft.SqlTools.ServiceLayer.UnitTests.UtilityTests
|
||||
new object[] {"name]", false },
|
||||
new object[] {"[]name", false},
|
||||
new object[] {"name[]", false},
|
||||
new object[] {"[na]me", false },
|
||||
new object[] {"[na]me", false },
|
||||
};
|
||||
|
||||
[Test, TestCaseSource(nameof(bracketed))]
|
||||
|
||||
Reference in New Issue
Block a user