Ejemplo n.º 1
0
        public void DefaultIndentationCopiesPreviousLineIndentation()
        {
            var testEditor = TestEditorManager.Create("    |");

            testEditor.Input("\n");

            Assert.Equal("    \n    ", testEditor.Document.Text);
        }
Ejemplo n.º 2
0
        public void C_Indentation_ReIndents_Line_Following_Else_Statement()
        {
            var testEditor = TestEditorManager.Create("{\n    if(statement)\n        statement;\n    else|\n}", new CBasedLanguageIndentationInputHelper());

            testEditor.Input("\n");

            Assert.Equal("{\n    if(statement)\n        statement;\n    else\n        \n}", testEditor.Document.Text);
        }
Ejemplo n.º 3
0
        public void C_Indentation_Inserts_Indentation_When_NewLine_Inserted_Between_2_Braces()
        {
            var testEditor = TestEditorManager.Create("{|}", new CBasedLanguageIndentationInputHelper());

            testEditor.Input("\n");

            Assert.Equal("{\n    \n}", testEditor.Document.Text);
        }
Ejemplo n.º 4
0
        public void C_Indentation_ReIndents_Statement_With_Too_Much_Indentation_On_SemiColon()
        {
            var testEditor = TestEditorManager.Create("{\n        statement()|\n}", new CBasedLanguageIndentationInputHelper());

            testEditor.Input(";");

            Assert.Equal("{\n    statement();\n}", testEditor.Document.Text);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Creates an instance of TestEditorManager
        /// </summary>
        /// <param name="initialText">The initial text of the document. If this contains a '|' charactor, it will be removed and the editor caret position set to that location.</param>
        /// <param name="helpers">Any helpers to use for testing.</param>
        /// <returns></returns>
        public static TestEditorManager Create(string initialText, params ITextEditorInputHelper[] helpers)
        {
            var index = initialText.IndexOf('|');

            if (index >= 0)
            {
                initialText = initialText.Replace("|", "");
            }

            var result = new TestEditorManager(initialText, helpers);

            if (index >= 0)
            {
                result.SetCursor(index);
            }

            return(result);
        }