Skip to content

Commit 5d2080a

Browse files
authored
Use IndexOf instead of hardcoded code markers (#136)
* Update TestUtilities.cs Signed-off-by: Zi Chen <[email protected]> * Use IndexOf instead of hardcoded values --------- Signed-off-by: Zi Chen <[email protected]>
1 parent 8727aa0 commit 5d2080a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Test/SqlDom/ParserErrorsTests.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6824,7 +6824,7 @@ RETURNS VARCHAR(20)
68246824
RETURN '$' + CAST(@amount AS VARCHAR)
68256825
END;
68266826
";
6827-
ParserTestUtils.ErrorTestFabricDW(scalarFunctionSyntax, new ParserErrorInfo(330, "SQL46026", "ENCRYPTION"));
6827+
ParserTestUtils.ErrorTestFabricDW(scalarFunctionSyntax, new ParserErrorInfo(scalarFunctionSyntax.IndexOf("ENCRYPTION"), "SQL46026", "ENCRYPTION"));
68286828

68296829
string scalarFunctionSyntax2 = @"CREATE OR ALTER FUNCTION dbo.ConcatNames
68306830
(
@@ -6837,7 +6837,7 @@ RETURNS NVARCHAR(101)
68376837
BEGIN
68386838
RETURN @first + ' ' + @last
68396839
END;";
6840-
ParserTestUtils.ErrorTestFabricDW(scalarFunctionSyntax2, new ParserErrorInfo(425, "SQL46010", "INLINE"));
6840+
ParserTestUtils.ErrorTestFabricDW(scalarFunctionSyntax2, new ParserErrorInfo(scalarFunctionSyntax2.IndexOf("INLINE"), "SQL46010", "INLINE"));
68416841

68426842
string scalarFunctionSyntax3 = @"CREATE OR ALTER FUNCTION dbo.CountProducts
68436843
(
@@ -6849,7 +6849,7 @@ WITH SCHEMABINDING
68496849
BEGIN
68506850
RETURN (SELECT COUNT(*) FROM @ProductTable)
68516851
END;";
6852-
ParserTestUtils.ErrorTestFabricDW(scalarFunctionSyntax3, new ParserErrorInfo(172, "SQL46026", "READONLY"));
6852+
ParserTestUtils.ErrorTestFabricDW(scalarFunctionSyntax3, new ParserErrorInfo(scalarFunctionSyntax3.IndexOf("READONLY"), "SQL46026", "READONLY"));
68536853

68546854
string scalarFunctionSyntax4 = @"CREATE OR ALTER FUNCTION sales.TotalSalesForRegion
68556855
(
@@ -6866,7 +6866,7 @@ FROM @SalesData
68666866
WHERE RegionId = @RegionId
68676867
)
68686868
END;";
6869-
ParserTestUtils.ErrorTestFabricDW(scalarFunctionSyntax4, new ParserErrorInfo(171, "SQL46010", "NULL"));
6869+
ParserTestUtils.ErrorTestFabricDW(scalarFunctionSyntax4, new ParserErrorInfo(scalarFunctionSyntax4.IndexOf("NULL"), "SQL46010", "NULL"));
68706870
}
68716871
}
68726872
}

0 commit comments

Comments
 (0)