Package com.aptana.shared_core.utils

Examples of com.aptana.shared_core.utils.DocCmd


        strategy.setIndentPrefs(new TestIndentPrefs(true, 4));

        String doc = "" +
                "a = (1, \n" +
                "  2,"; //should keep this indent, and not go to the opening bracket indent.
        DocCmd docCmd = new DocCmd(doc.length(), 0, "\n");
        strategy.customizeDocumentCommand(new Document(doc), docCmd);
        String expected = "\n  ";
        assertEquals(expected, docCmd.text);
    }
View Full Code Here


        String doc = "" +
                "def m1(): #some comment\n" +
                "    print foo(a,\n" +
                "              b)";
        DocCmd docCmd = new DocCmd(doc.length(), 0, "\n");
        strategy.customizeDocumentCommand(new Document(doc), docCmd);
        String expected = "\n    ";
        assertEquals(expected, docCmd.text);
    }
View Full Code Here

        String doc = "" +
                "def m1(): #some comment\n" +
                "    def metfoo(a,\n" +
                "               b):";
        DocCmd docCmd = new DocCmd(doc.length(), 0, "\n");
        strategy.customizeDocumentCommand(new Document(doc), docCmd);
        String expected = "\n        ";
        assertEquals(expected, docCmd.text);
    }
View Full Code Here

        prefs.smartIndentAfterPar = false;
        strategy.setIndentPrefs(prefs);

        String doc = "" +
                "def m1(): \n";
        DocCmd docCmd = new DocCmd(0, 0, "\n");
        strategy.customizeDocumentCommand(new Document(doc), docCmd);
        String expected = "\n";
        assertEquals(expected, docCmd.text);
    }
View Full Code Here

    public void testDedent() {
        strategy.setIndentPrefs(new TestIndentPrefs(true, 4));

        String doc = "def m1(): #some comment\n" +
                "    return 10";
        DocCmd docCmd = new DocCmd(doc.length(), 0, "\n");
        strategy.customizeDocumentCommand(new Document(doc), docCmd);
        String expected = "\n";
        assertEquals(expected, docCmd.text);

        //test ending with
        doc = "def m1(): #some comment\n" +
                "    return";
        docCmd = new DocCmd(doc.length(), 0, "\n");
        strategy.customizeDocumentCommand(new Document(doc), docCmd);
        expected = "\n";
        assertEquals(expected, docCmd.text);

        //test not dedenting
        doc = "def m1(): #some comment\n" +
                "    returnIs10 = 10";
        docCmd = new DocCmd(doc.length(), 0, "\n");
        strategy.customizeDocumentCommand(new Document(doc), docCmd);
        expected = "\n" +
                "    ";
        assertEquals(expected, docCmd.text);
View Full Code Here

    public void testIndentSpaces() {
        //test after class xxx:\n
        strategy.setIndentPrefs(new TestIndentPrefs(true, 4));
        String doc = "class c:";
        DocCmd docCmd = new DocCmd(doc.length(), 0, "\n");
        strategy.customizeDocumentCommand(new Document(doc), docCmd);
        String expected = "\n" +
                "    ";
        assertEquals(expected, docCmd.text);

        //test regular
        doc = "    a = 2";
        docCmd = new DocCmd(doc.length(), 0, "\n");
        strategy.customizeDocumentCommand(new Document(doc), docCmd);
        expected = "\n" +
                "    ";
        assertEquals(expected, docCmd.text);

        //test after [ a,\n
        doc = "m = [a,";
        docCmd = new DocCmd(doc.length(), 0, "\n");
        strategy.customizeDocumentCommand(new Document(doc), docCmd);
        expected = "\n" +
                "     ";
        assertEquals(expected, docCmd.text);
    }
View Full Code Here

    }

    public void testAfterClosePar1() {
        strategy.setIndentPrefs(new TestIndentPrefs(true, 4));
        String doc = "m = [a,";
        DocCmd docCmd = new DocCmd(doc.length(), 0, "\n");
        strategy.customizeDocumentCommand(new Document(doc), docCmd);
        String expected = "\n" +
                "     ";
        assertEquals(expected, docCmd.text);
View Full Code Here

    public void testAfterCloseParOnlyIndent() {
        final TestIndentPrefs prefs = new TestIndentPrefs(true, 4);
        strategy.setIndentPrefs(prefs);
        prefs.indentToParLevel = false;
        String doc = "m = [a,";
        DocCmd docCmd = new DocCmd(doc.length(), 0, "\n");
        strategy.customizeDocumentCommand(new Document(doc), docCmd);
        String expected = "\n" +
                "    ";
        assertEquals(expected, docCmd.text);
View Full Code Here

        strategy.setIndentPrefs(prefs);
        prefs.indentToParLevel = false;
        String doc = "" +
                "class A:\n" +
                "    def m1(a,";
        DocCmd docCmd = new DocCmd(doc.length(), 0, "\n");
        strategy.customizeDocumentCommand(new Document(doc), docCmd);
        String expected = "\n" +
                "        ";
        assertEquals(expected, docCmd.text);
View Full Code Here

        strategy.setIndentPrefs(prefs);
        prefs.indentToParLevel = false;
        prefs.indentAfterParWidth = 2;
        String doc = "" +
                "__author__ = [";
        DocCmd docCmd = new DocCmd(doc.length(), 0, "\n");
        strategy.customizeDocumentCommand(new Document(doc), docCmd);
        String expected = "\n" +
                "      ";
        assertEquals(expected, docCmd.text);
View Full Code Here

TOP

Related Classes of com.aptana.shared_core.utils.DocCmd

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.