Exemplo n.º 1
0
        public void SpanWithAcceptTrailingDotOnAcceptsIntelliSenseReplaceWhichActuallyInsertsDot()
        {
            // Arrange
            var span       = new ImplicitExpressionSpan("abcd", CSharpCodeParser.DefaultKeywords, acceptTrailingDot: true, acceptedCharacters: AcceptedCharacters.None);
            var newBuffer  = new StringTextBuffer("abcd.");
            var oldBuffer  = new StringTextBuffer("abcd");
            var textChange = new TextChange(0, 4, oldBuffer, 5, newBuffer);

            // Act
            PartialParseResult result = span.ApplyChange(textChange);

            // Assert
            Assert.AreEqual(PartialParseResult.Accepted, result);
        }
Exemplo n.º 2
0
        public void SpanWithAcceptTrailingDotOffProvisionallyAcceptsEndReplacementWithTrailingDot()
        {
            // Arrange
            var span       = new ImplicitExpressionSpan("abcd.", CSharpCodeParser.DefaultKeywords, acceptTrailingDot: false, acceptedCharacters: AcceptedCharacters.None);
            var newBuffer  = new StringTextBuffer("abcdef.");
            var oldBuffer  = new StringTextBuffer("abcd.");
            var textChange = new TextChange(0, 5, oldBuffer, 7, newBuffer);

            // Act
            PartialParseResult result = span.ApplyChange(textChange);

            // Assert
            Assert.AreEqual(PartialParseResult.Accepted | PartialParseResult.Provisional, result);
        }