public void RBraceMatch_Braces() { ITextView tv = TextViewTest.MakeTextViewRealTextBuffer("a(\"( )\")b", _exportProvider); RBraceMatcher bm = new RBraceMatcher(tv, tv.TextBuffer); int startPosition, endPosition; bool result; result = bm.GetBracesFromPosition(tv.TextBuffer.CurrentSnapshot, 0, false, out startPosition, out endPosition); result.Should().BeFalse(); result = bm.GetBracesFromPosition(tv.TextBuffer.CurrentSnapshot, 1, false, out startPosition, out endPosition); result.Should().BeTrue(); startPosition.Should().Be(1); endPosition.Should().Be(7); result = bm.GetBracesFromPosition(tv.TextBuffer.CurrentSnapshot, 2, false, out startPosition, out endPosition); result.Should().BeTrue(); startPosition.Should().Be(1); endPosition.Should().Be(7); result = bm.GetBracesFromPosition(tv.TextBuffer.CurrentSnapshot, 3, false, out startPosition, out endPosition); result.Should().BeFalse(); }
public void RBraceMatch_CurlyBraces01() { ITextView tv = TextViewTest.MakeTextViewRealTextBuffer("a{\"{ }\"}b", _services); RBraceMatcher bm = new RBraceMatcher(tv, tv.TextBuffer); int startPosition, endPosition; bool result; result = bm.GetBracesFromPosition(tv.TextBuffer.CurrentSnapshot, 0, false, out startPosition, out endPosition); result.Should().BeFalse(); result = bm.GetBracesFromPosition(tv.TextBuffer.CurrentSnapshot, 1, false, out startPosition, out endPosition); result.Should().BeTrue(); startPosition.Should().Be(1); endPosition.Should().Be(7); result = bm.GetBracesFromPosition(tv.TextBuffer.CurrentSnapshot, 2, false, out startPosition, out endPosition); result.Should().BeTrue(); startPosition.Should().Be(1); endPosition.Should().Be(7); result = bm.GetBracesFromPosition(tv.TextBuffer.CurrentSnapshot, 3, false, out startPosition, out endPosition); result.Should().BeFalse(); }
public void RBraceMatch_MixedBraces() { ITextView tv = TextViewTest.MakeTextViewRealTextBuffer("{a[[b()]]}", _exportProvider); RBraceMatcher bm = new RBraceMatcher(tv, tv.TextBuffer); int startPosition, endPosition; bool result; result = bm.GetBracesFromPosition(tv.TextBuffer.CurrentSnapshot, 0, false, out startPosition, out endPosition); result.Should().BeTrue(); startPosition.Should().Be(0); endPosition.Should().Be(9); result = bm.GetBracesFromPosition(tv.TextBuffer.CurrentSnapshot, 2, false, out startPosition, out endPosition); result.Should().BeTrue(); startPosition.Should().Be(2); endPosition.Should().Be(8); result = bm.GetBracesFromPosition(tv.TextBuffer.CurrentSnapshot, 3, false, out startPosition, out endPosition); result.Should().BeTrue(); startPosition.Should().Be(3); endPosition.Should().Be(7); result = bm.GetBracesFromPosition(tv.TextBuffer.CurrentSnapshot, 5, false, out startPosition, out endPosition); result.Should().BeTrue(); startPosition.Should().Be(5); endPosition.Should().Be(6); result = bm.GetBracesFromPosition(tv.TextBuffer.CurrentSnapshot, 6, false, out startPosition, out endPosition); result.Should().BeTrue(); startPosition.Should().Be(5); endPosition.Should().Be(6); result = bm.GetBracesFromPosition(tv.TextBuffer.CurrentSnapshot, 7, false, out startPosition, out endPosition); result.Should().BeTrue(); startPosition.Should().Be(3); endPosition.Should().Be(7); result = bm.GetBracesFromPosition(tv.TextBuffer.CurrentSnapshot, 8, false, out startPosition, out endPosition); result.Should().BeTrue(); startPosition.Should().Be(2); endPosition.Should().Be(8); result = bm.GetBracesFromPosition(tv.TextBuffer.CurrentSnapshot, 9, false, out startPosition, out endPosition); result.Should().BeTrue(); startPosition.Should().Be(0); endPosition.Should().Be(9); }
public void RBraceMatch_CurlyBraces02() { var tv = TextViewTest.MakeTextViewRealTextBuffer("{{\"{ }\"}}", _services).As <ITextView>(); var bm = new RBraceMatcher(tv, tv.TextBuffer); var result = bm.GetBracesFromPosition(tv.TextBuffer.CurrentSnapshot, 0, false, out int startPosition, out int endPosition); result.Should().BeTrue(); startPosition.Should().Be(0); endPosition.Should().Be(8); result = bm.GetBracesFromPosition(tv.TextBuffer.CurrentSnapshot, 1, false, out startPosition, out endPosition); result.Should().BeTrue(); startPosition.Should().Be(1); endPosition.Should().Be(7); result = bm.GetBracesFromPosition(tv.TextBuffer.CurrentSnapshot, 3, false, out startPosition, out endPosition); result.Should().BeFalse(); }