Пример #1
0
        private static void T(string codeWithCaret)
        {
            int caret          = codeWithCaret.IndexOf('|');
            int expectedIndent = 0;

            while (caret - expectedIndent > 1 && codeWithCaret[caret - expectedIndent - 1] == ' ')
            {
                expectedIndent++;
            }

            var code         = codeWithCaret.Remove(caret, 1);
            var syntaxTree   = SyntaxFactory.ParseSyntaxTree(SourceText.From(code));
            var actualIndent = SmartIndent.FindTotalParentChainIndent(syntaxTree.Root, caret, 0);

            Assert.Equal(expectedIndent, actualIndent);
        }
Пример #2
0
        private void T(string xmlWithCaret)
        {
            int caret          = xmlWithCaret.IndexOf('|');
            int expectedIndent = 0;

            while (caret - expectedIndent > 1 && xmlWithCaret[caret - expectedIndent - 1] == ' ')
            {
                expectedIndent++;
            }

            var xml          = xmlWithCaret.Remove(caret, 1);
            var root         = Parser.ParseText(xml);
            var actualIndent = SmartIndent.FindTotalParentChainIndent(root, caret, 0, 0);

            Assert.AreEqual(expectedIndent, actualIndent);
        }