public void SourceText_NextFilter(string text, int start, string expectedOutput, int newCursor) { var source = new SourceText(text.AsMemory(), start); var result = source.NextFilter(char.IsDigit); Assert.AreEqual(expectedOutput, result.ToString()); Assert.AreEqual(newCursor, source.Cursor); }
public void SourceText_NextFilter_FromEndOfLength() { var source = new SourceText("123".AsMemory()); var result = source.Next(source.Length); Assert.AreEqual("123", result.ToString()); Assert.AreEqual(3, source.Cursor); result = source.NextFilter(char.IsDigit); Assert.AreEqual(string.Empty, result.ToString()); Assert.AreEqual(3, source.Cursor); }