Package org.python.pydev.editor.autoedit

Examples of org.python.pydev.editor.autoedit.TestIndentPrefs


                "def m(b):\n" +
                "   pass\n" +
                "\n" +
                "");

        List<IMessage> messages = TabNanny.analyzeDoc(doc, this.prefs, "", new TestIndentPrefs(true, 4),
                new NullProgressMonitor());
        assertEquals(1, messages.size());
        IMessage m = messages.get(0);
        assertEquals("Bad Indentation (3 spaces)", m.getMessage());
        assertEquals(2, m.getStartLine(null));
View Full Code Here


        File file = new File(TestDependent.TEST_PYSRC_LOC +
                "extendable/with_path.py");
        Document doc = new Document(FileUtils.getFileContents(file));
        msgs = analyzer.analyzeDocument(nature,
                (SourceModule) AbstractModule.createModule("extendable.with_path", file, nature, true), prefs, doc,
                new NullProgressMonitor(), new TestIndentPrefs(true, 4));

        printMessages(msgs, 0);
    }
View Full Code Here

        File file = new File(TestDependent.TEST_PYSRC_LOC +
                "extendable/__init__.py");
        Document doc = new Document(FileUtils.getFileContents(file));
        msgs = analyzer.analyzeDocument(nature,
                (SourceModule) AbstractModule.createModule("extendable.__init__", file, nature, true), prefs, doc,
                new NullProgressMonitor(), new TestIndentPrefs(true, 4));

        printMessages(msgs, 0);
    }
View Full Code Here

     * @see TestCase#setUp()
     */
    protected void setUp() throws Exception {
        super.setUp();
        this.peerLinker = new PyPeerLinker();
        this.peerLinker.setIndentPrefs(new TestIndentPrefs(true, 4));
    }
View Full Code Here

    private IMessage[] analyzeDoc() {
        try {
            return analyzer.analyzeDocument(nature,
                    (SourceModule) AbstractModule.createModuleFromDoc(null, null, doc, nature, true), prefs, doc,
                    new NullProgressMonitor(), new TestIndentPrefs(true, 4));
        } catch (MisconfigurationException e) {
            throw new RuntimeException(e);
        }
    }
View Full Code Here

        assertEquals("    ", docCmd.text);
        assertEquals(str, document.get()); //as we already have a selection, nothing should be deleted
    }

    public void testTab3() {
        strategy.setIndentPrefs(new TestIndentPrefs(false, 4));
        String str = "\tprint 'foo'";
        DocCmd docCmd = new DocCmd(1, 0, "\t");
        Document document = new Document(str);
        strategy.customizeDocumentCommand(document, docCmd);
        assertEquals("\t", docCmd.text);
View Full Code Here

        assertEquals("\t", docCmd.text);
        assertEquals(str, document.get()); //as we already have a selection, nothing should be deleted
    }

    public void testTab4() {
        strategy.setIndentPrefs(new TestIndentPrefs(true, 4));
        String str = "" +
                "class MyClass:\n" +
                "    def NextMethod(self,\n" +
                "                    c):\n" +
                "\n" + //-3 :in this line
View Full Code Here

            assertEquals(str, document.get());
        }
    }

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

        docCmd = new DocCmd(0, 0, "\t\t");
View Full Code Here

        strategy.customizeDocumentCommand(new Document(""), docCmd);
        assertEquals(" ", docCmd.text);
    }

    public void testNewLineAfterReturn() {
        strategy.setIndentPrefs(new TestIndentPrefs(true, 4));
        String str = "" +
                "def m1(self):\n" +
                "    return 'foo'\n" +
                "#ffo" +
                "" +
View Full Code Here

        assertEquals("\n", docCmd.text);

    }

    public void testIgnoreComment() {
        strategy.setIndentPrefs(new TestIndentPrefs(true, 4));
        String str = "" +
                "titleEnd = ('[#')" +
                "";
        final Document doc = new Document(str);
        DocCmd docCmd = new DocCmd(doc.getLength(), 0, "\n");
View Full Code Here

TOP

Related Classes of org.python.pydev.editor.autoedit.TestIndentPrefs

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.