Skip to content

Use IndexOf instead of hardcoded code markers #136

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 6, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Test/SqlDom/ParserErrorsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6824,7 +6824,7 @@ RETURNS VARCHAR(20)
RETURN '$' + CAST(@amount AS VARCHAR)
END;
";
ParserTestUtils.ErrorTestFabricDW(scalarFunctionSyntax, new ParserErrorInfo(330, "SQL46026", "ENCRYPTION"));
ParserTestUtils.ErrorTestFabricDW(scalarFunctionSyntax, new ParserErrorInfo(scalarFunctionSyntax.IndexOf("ENCRYPTION"), "SQL46026", "ENCRYPTION"));

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

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

string scalarFunctionSyntax4 = @"CREATE OR ALTER FUNCTION sales.TotalSalesForRegion
(
Expand All @@ -6866,7 +6866,7 @@ FROM @SalesData
WHERE RegionId = @RegionId
)
END;";
ParserTestUtils.ErrorTestFabricDW(scalarFunctionSyntax4, new ParserErrorInfo(171, "SQL46010", "NULL"));
ParserTestUtils.ErrorTestFabricDW(scalarFunctionSyntax4, new ParserErrorInfo(scalarFunctionSyntax4.IndexOf("NULL"), "SQL46010", "NULL"));
}
}
}
Loading