SqlScriptDOM
SqlScriptDOM copied to clipboard
Adding a test to verify parsing Select With no hints
Adding a new test to verify the bug in #91
A more general way of testing this would be to add:
class VerifyTokenIndexesVisitor : TSqlFragmentVisitor
{
public override void Visit(TSqlFragment node)
{
if (node.FirstTokenIndex == TSqlFragment.Uninitialized || node.LastTokenIndex == TSqlFragment.Uninitialized)
{
Assert.Fail("Uninitialized tokens: " + node.GetType().Name);
}
}
}
and using it here https://github.com/microsoft/SqlScriptDOM/blob/8367b6e173eed29204c5643ba1c3d1a7aa61ab5b/Test/SqlDom/ParserTest.cs#L180C14-L180C14 like so:
if (errors.Count == 0)
{
fragment.Accept(new VerifyTokenIndexesVisitor());
...
But at the moment that makes 59 tests fail.