Ejemplo n.º 1
0
        public void TryMergeWithLeavesTypeVisibilityAndTrackingModeUnchanged() {
            // Arrange
            Span left = new CodeSpan(SourceLocation.Zero, "Foo", hidden: true, acceptedCharacters: AcceptedCharacters.None);
            Span right = new MetaCodeSpan(new SourceLocation(3, 0, 0), "Bar");

            // Act
            bool success = left.TryMergeWith(right);

            // Assert
            Assert.IsTrue(success);
            Assert.AreEqual(SpanKind.Code, left.Kind);
            Assert.IsTrue(left.Hidden);
        }
Ejemplo n.º 2
0
        public void TryMergeWithReturnsTrueAndCorrectlyMergesWhenMergingRightIntoLeftIfSpansAreAdjacent() {
            // Arrange
            Span left = new CodeSpan(new SourceLocation(3, 0, 0), "Foo");
            Span right = new CodeSpan(SourceLocation.Zero, "Bar");

            // Act
            bool success = left.TryMergeWith(right);

            // Assert
            Assert.IsTrue(success);
            Assert.AreEqual("BarFoo", left.Content);
            Assert.AreEqual(SourceLocation.Zero, left.Start);
        }
Ejemplo n.º 3
0
        public void TryMergeWithReturnsFalseWhenMergingRightIntoLeftIfSpansNotAdjacent() {
            // Arrange
            Span left = new CodeSpan(new SourceLocation(100, 0, 0), "Foo");
            Span right = new CodeSpan(SourceLocation.Zero, "Bar");

            // Act/Assert
            Assert.IsFalse(left.TryMergeWith(right));
        }