SqlScriptDOM icon indicating copy to clipboard operation
SqlScriptDOM copied to clipboard

Adding a test to verify parsing Select With no hints

Open llali opened this issue 1 year ago • 1 comments

Adding a new test to verify the bug in #91

llali avatar Sep 13 '24 21:09 llali

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.

vemoo avatar Sep 14 '24 08:09 vemoo