Package com.aptana.shared_core.utils

Examples of com.aptana.shared_core.utils.DocCmd


        TestIndentPrefs prefs = new TestIndentPrefs(false, 4, true);
        prefs.smartIndentAfterPar = false;
        strategy.setIndentPrefs(prefs);

        String doc = null;
        DocCmd docCmd = null;
        String expected = null;

        //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);

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

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


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

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

        //test regular
        doc = "\ta = 2";
        docCmd = new DocCmd(doc.length(), 0, "\n");
        strategy.customizeDocumentCommand(new Document(doc), docCmd);
        expected = "\n" +
                "\t";
        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" +
                "\t";
        assertEquals(expected, docCmd.text);

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

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

    }

    public void testAutoClose() {
        strategy.setIndentPrefs(new TestIndentPrefs(false, 4, true));
        String doc = "class c(object): ";
        DocCmd docCmd = new DocCmd(doc.length(), 0, "[");
        strategy.customizeDocumentCommand(new Document(doc), docCmd);
        String expected = "[]";
        assertEquals(expected, docCmd.text);

    }
View Full Code Here

    public void testAutoSelf() {
        TestIndentPrefs testIndentPrefs = new TestIndentPrefs(false, 4, true);
        testIndentPrefs.autoAddSelf = false;
        strategy.setIndentPrefs(testIndentPrefs);
        String doc = null;
        DocCmd docCmd = null;
        String expected = null;

        doc = "class c:\n" +
                "    def met";
        docCmd = new DocCmd(doc.length(), 0, "(");
        strategy.customizeDocumentCommand(new Document(doc), docCmd);
        expected = "():";
        assertEquals(expected, docCmd.text);

    }
View Full Code Here

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

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

    public void testAutoCls() {
        TestIndentPrefs testIndentPrefs = new TestIndentPrefs(false, 4, true);
        strategy.setIndentPrefs(testIndentPrefs);
        String doc = null;
        DocCmd docCmd = null;
        String expected = null;

        doc = "class c:\n" +
                "    @classmethod\n" +
                "    def met";
        docCmd = new DocCmd(doc.length(), 0, "(");
        strategy.customizeDocumentCommand(new Document(doc), docCmd);
        expected = "(cls):";
        assertEquals(expected, docCmd.text);

    }
View Full Code Here

    public void testNoAutoSelf() {
        TestIndentPrefs testIndentPrefs = new TestIndentPrefs(false, 4, true);
        strategy.setIndentPrefs(testIndentPrefs);
        String doc = null;
        DocCmd docCmd = null;
        String expected = null;

        doc = "class c:\n" +
                "    def met(self):\n" +
                "        def inner";
        docCmd = new DocCmd(doc.length(), 0, "(");
        strategy.customizeDocumentCommand(new Document(doc), docCmd);
        expected = "():";
        assertEquals(expected, docCmd.text);
    }
View Full Code Here

    public void testSmartIndent() {
        TestIndentPrefs testIndentPrefs = new TestIndentPrefs(true, 4);
        strategy.setIndentPrefs(testIndentPrefs);
        String doc = null;
        DocCmd docCmd = null;
        String expected = null;

        doc = "class SuperContainer:\n" +
                "    def SuperMethod(self):\n" +
                "        pass\n" +
                "       " +
                "";
        docCmd = new DocCmd(doc.length(), 0, "\t");
        strategy.customizeDocumentCommand(new Document(doc), docCmd);
        expected = " ";
        assertEquals(expected, docCmd.text);
    }
View Full Code Here

    public void testNoAutoSelf2() {
        TestIndentPrefs testIndentPrefs = new TestIndentPrefs(false, 4, true);
        strategy.setIndentPrefs(testIndentPrefs);
        String doc = null;
        DocCmd docCmd = null;
        String expected = null;

        doc = "class c:\n" +
                "    @staticmethod\n" +
                "    def met";
        docCmd = new DocCmd(doc.length(), 0, "(");
        strategy.customizeDocumentCommand(new Document(doc), docCmd);
        expected = "():";
        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.