public static void AssertIs <T>( this IToken token, int expectedStart, int expectedLength) where T : IToken { Assert.NotNull(token); token.AssertOfType <T>(); Assert.True(expectedStart == token.Span.Start, $"Expected token start {expectedStart}, was {token.Span.Start}"); Assert.True(expectedLength == token.Span.Length, $"Expected token length {expectedLength}, was {token.Span.Length}"); }
public static void AssertStringLiteral( this IToken token, int expectedStart, int expectedLength, string expectedValue) { Assert.NotNull(token); var identifier = token.AssertOfType <IStringLiteralToken>(); Assert.True(expectedStart == identifier.Span.Start, $"Expected token start {expectedStart}, was {identifier.Span.Start}"); Assert.True(expectedLength == identifier.Span.Length, $"Expected token length {expectedLength}, was {identifier.Span.Length}"); Assert.Equal(expectedValue, identifier.Value); }