Example #1
0
        public void OwnsChangeReturnsFalseIfChangeIsInsertionAtSpanEndAndCanGrowIsFalse()
        {
            // Arrange
            Span       span   = new CodeSpan(new SourceLocation(42, 0, 42), "FooBarBaz", hidden: false, acceptedCharacters: AcceptedCharacters.None);
            TextChange change = new TextChange(51, 0, new StringTextBuffer("BooBarBaz"), 3, new StringTextBuffer("Foo"));

            // Act/Assert
            Assert.IsFalse(span.OwnsChange(change));
        }
Example #2
0
        public void OwnsChangeReturnsFalseIfChangeIsReplacementOrDeleteAtSpanEnd()
        {
            // Arrange
            Span       span   = new CodeSpan(new SourceLocation(42, 0, 42), "FooBarBaz");
            TextChange change = new TextChange(51, 2, new StringTextBuffer("BooBarBaz"), 3, new StringTextBuffer("Foo"));

            // Act/Assert
            Assert.IsFalse(span.OwnsChange(change));
        }
Example #3
0
        public void OwnsChangeReturnsTrueIfChangeIsInsertionAtSpanEndAndCanGrowIsTrue()
        {
            // Arrange
            Span       span   = new CodeSpan(new SourceLocation(42, 0, 42), "FooBarBaz");
            TextChange change = new TextChange(51, 0, new StringTextBuffer("BooBarBaz"), 3, new StringTextBuffer("Foo"));

            // Act/Assert
            Assert.IsTrue(span.OwnsChange(change));
        }
Example #4
0
        public void OwnsChangeReturnsFalseIfChangeStartsAfterSpanEnds()
        {
            // Arrange
            Span       span   = new CodeSpan(new SourceLocation(42, 0, 42), "FooBarBaz");
            TextChange change = new TextChange(52, 3, new StringTextBuffer("BooBarBaz"), 3, new StringTextBuffer("Foo"));

            // Act/Assert
            Assert.IsFalse(span.OwnsChange(change));
        }
Example #5
0
        public void OwnsChangeReturnsTrueIfSpanContentEntirelyContainsOldSpan()
        {
            // Arrange
            Span       span   = new CodeSpan(new SourceLocation(42, 0, 42), "FooBarBaz");
            TextChange change = new TextChange(45, 3, new StringTextBuffer("BooBarBaz"), 3, new StringTextBuffer("Foo"));

            // Act/Assert
            Assert.IsTrue(span.OwnsChange(change));
        }
Example #6
0
        public void OwnsChangeReturnsFalseIfOldSpanOverlapsNeighbouringSpan()
        {
            // Arrange
            Span       span   = new CodeSpan(new SourceLocation(42, 0, 42), "FooBarBaz");
            TextChange change = new TextChange(44, 50, new StringTextBuffer("BooBarBaz"), 3, new StringTextBuffer("Foo"));

            // Act/Assert
            Assert.IsFalse(span.OwnsChange(change));
        }