Package com.aptana.shared_core.utils

Examples of com.aptana.shared_core.utils.DocCmd


        String str = "" +
                "class C:\n" +
                "    pass\n" +
                "";
        final Document doc = new Document(str);
        DocCmd docCmd = new DocCmd(doc.getLength(), 0, "\t");
        strategy.customizeDocumentCommand(doc, docCmd);
        assertEquals("    ", docCmd.text); // a single tab should go to the correct indent
    }
View Full Code Here


                "class C:\n" +
                "    def m1(self):            \n" +
                "        print 1\n" +
                "";
        final Document doc = new Document(str);
        DocCmd docCmd = new DocCmd(doc.getLength(), 0, "\t");
        strategy.customizeDocumentCommand(doc, docCmd);
        assertEquals("        ", docCmd.text); // a single tab should go to the correct indent
    }
View Full Code Here

        String str = "" +
                "class C:\n" +
                "    def m1(self):" +
                "";
        final Document doc = new Document(str);
        DocCmd docCmd = new DocCmd(doc.getLength(), 0, "\n");
        strategy.customizeDocumentCommand(doc, docCmd);
        assertEquals("\n        ", docCmd.text); // a single tab should go to the correct indent
    }
View Full Code Here

                "    def m1(self):            \n" +
                "        print 'a'\n" +
                "        " + //now, a 'regular' tab should happen
                "";
        final Document doc = new Document(str);
        DocCmd docCmd = new DocCmd(doc.getLength(), 0, "\t");
        strategy.customizeDocumentCommand(doc, docCmd);
        assertEquals("    ", docCmd.text); // a single tab should go to the correct indent
    }
View Full Code Here

                "    def m1(self):            \n" +
                "        print 'a'\n" +
                "       " + //now, only 1 space is missing to the correct indent
                "";
        final Document doc = new Document(str);
        DocCmd docCmd = new DocCmd(doc.getLength(), 0, "\t");
        strategy.customizeDocumentCommand(doc, docCmd);
        assertEquals(" ", docCmd.text); // a single tab should go to the correct indent
    }
View Full Code Here

                "class C:\n" +
                "    def m1(self):            \n" +
                "print 'a'" +
                "";
        final Document doc = new Document(str);
        DocCmd docCmd = new DocCmd(doc.getLength() - "print 'a'".length(), 0, "\t");
        strategy.customizeDocumentCommand(doc, docCmd);
        assertEquals("        ", docCmd.text); // a single tab should go to the correct indent
    }
View Full Code Here

                "class C:\n" +
                "    def m1(self):            \n" +
                "print 'a'" +
                "";
        final Document doc = new Document(str);
        DocCmd docCmd = new DocCmd(doc.getLength() - "  print 'a'".length(), 0, "\t");
        strategy.customizeDocumentCommand(doc, docCmd);
        assertEquals("        ", docCmd.text); // a single tab should go to the correct indent
        assertEquals(expected, doc.get()); // the spaces after the indent should be removed
    }
View Full Code Here

        assertEquals(expected, doc.get()); // the spaces after the indent should be removed
    }

    public void testTabs() {
        strategy.setIndentPrefs(new TestIndentPrefs(false, 4));
        DocCmd docCmd = new DocCmd(0, 0, "\t");
        strategy.customizeDocumentCommand(new Document(""), docCmd);
        assertEquals("\t", docCmd.text);

        docCmd = new DocCmd(0, 0, "\t\t");
        strategy.customizeDocumentCommand(new Document(""), docCmd);
        assertEquals("\t\t", docCmd.text);

        docCmd = new DocCmd(0, 0, "\tabc");
        strategy.customizeDocumentCommand(new Document(""), docCmd);
        assertEquals("\tabc", docCmd.text);

        docCmd = new DocCmd(0, 0, "\tabc\t");
        strategy.customizeDocumentCommand(new Document(""), docCmd);
        assertEquals("\tabc\t", docCmd.text);

        docCmd = new DocCmd(0, 0, "    abc"); //paste
        strategy.customizeDocumentCommand(new Document(""), docCmd);
        assertEquals("\tabc", docCmd.text);
    }
View Full Code Here

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

        doc = "class c: #some comment";
        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 testCommentsIndent2() {
        strategy.setIndentPrefs(new TestIndentPrefs(true, 4));
        //test not indent more
        doc = "    # comment:";
        docCmd = new DocCmd(doc.length(), 0, "\n");
        strategy.customizeDocumentCommand(new Document(doc), docCmd);
        expected = "\n" +
                "    ";
        assertEquals(expected, docCmd.text);

        //test indent more
        doc = "    if False:";
        docCmd = new DocCmd(doc.length(), 0, "\n");
        strategy.customizeDocumentCommand(new Document(doc), docCmd);
        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.