Example #1
0
        public void EditorTree_InvalidateInRangeTest()
        {
            EditorTree tree = EditorTreeTest.MakeTree("if(true) x <- a + b");

            bool nodesChanged = false;
            bool result       = tree.InvalidateInRange(tree.AstRoot, new TextRange(4, 1), out nodesChanged);

            result.Should().BeTrue();
            nodesChanged.Should().BeTrue();
        }
Example #2
0
        public void InvalidateAllInRange(string content, int start, int length)
        {
            EditorTree tree = EditorTreeTest.MakeTree(content);

            bool nodesChanged = tree.InvalidateInRange(new TextRange(start, length));

            nodesChanged.Should().BeTrue();

            tree.AstRoot.Children.Should().ContainSingle();
            tree.AstRoot.Children[0].Should().BeOfType <GlobalScope>();
            tree.AstRoot.Children[0].Children.Should().BeEmpty();
        }
Example #3
0
        public void InvalidatePartsInRange01(string content, int start, int length)
        {
            EditorTree tree = EditorTreeTest.MakeTree(content);

            bool nodesChanged = tree.InvalidateInRange(new TextRange(start, length));

            nodesChanged.Should().BeTrue();

            tree.AstRoot.Children.Should().ContainSingle();
            tree.AstRoot.Children[0].Should().BeOfType <GlobalScope>();

            tree.AstRoot.Children[0].Children.Should().NotBeEmpty();
            tree.AstRoot.Children[0].Children[0].Should().BeOfType <If>();

            var ifStatement = tree.AstRoot.Children[0].Children[0] as If;

            ifStatement.Should().NotBeNull();
            ifStatement.Scope.Should().NotBeNull();
            ifStatement.Scope.Children.Count.Should().Be(2);
            ifStatement.Scope.OpenCurlyBrace.Should().NotBeNull();
            ifStatement.Scope.CloseCurlyBrace.Should().NotBeNull();
        }