Package org.python.pydev.editor.autoedit

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


        this.sourceFile = null;
        this.nature = null;
        this.versionProvider = versionProvider;
        this.doc = document;

        this.indentPrefs = PydevPlugin.getDefault() == null ? new TestIndentPrefs(document.get().indexOf('\t') < 0, 4)
                : DefaultIndentPrefs.get();

        initInfo(selection);
    }
View Full Code Here


                prompt, new ScriptConsoleHistory(), new ArrayList<IConsoleLineTracker>(), "",
                new PyAutoIndentStrategy());

        PyAutoIndentStrategy strategy = (PyAutoIndentStrategy) listener.getIndentStrategy();
        strategy.setIndentPrefs(new TestIndentPrefs(true, 4));
        listener.setDocument(doc);

        doc.replace(0, 0, ">>> class A:");
        doc.replace(doc.getLength(), 0, "\n");
        //Things happen in a thread now, so, we have to wait for it to happen...
View Full Code Here

    public void testShiftLeft1() throws Exception {
        Document doc = new Document("    def a(aa):\n" +
                "        pass\n" +
                "    \n");
        PySelection ps = new PySelection(doc, 0, 0, doc.getLength());
        new PyShiftLeft().perform(ps, new TestIndentPrefs(true, 4));

        String expected = "def a(aa):\n" +
                "    pass\n" +
                "\n";
        assertEquals(expected, doc.get());
View Full Code Here

    public void testShiftLeft2() throws Exception {
        Document doc = new Document("   def a(aa):\n" +
                "        pass\n" +
                "    \n");
        PySelection ps = new PySelection(doc, 0, 0, doc.getLength());
        new PyShiftLeft().perform(ps, new TestIndentPrefs(true, 4));

        String expected = "def a(aa):\n" +
                "     pass\n" +
                " \n";
        assertEquals(expected, doc.get());
View Full Code Here

    public void testShiftLeft3() throws Exception {
        Document doc = new Document("   def a(aa):\n" +
                "        pass\n" +
                "    bb\n");
        PySelection ps = new PySelection(doc, 0, 3, doc.getLength() - 2 - 3);
        new PyShiftLeft().perform(ps, new TestIndentPrefs(true, 4));

        String expected = "def a(aa):\n" +
                "     pass\n" +
                " bb\n";
        assertEquals(expected, doc.get());
View Full Code Here

                "    \n" +
                "    \t\n" +
                "ccc\n" +
                "");

        List<IMessage> messages = TabNanny.analyzeDoc(doc, this.prefs, "", new TestIndentPrefs(true, 4),
                new NullProgressMonitor());
        for (IMessage m : messages) {
            assertEquals("Mixed Indentation: Tab found", m.getMessage());
            int startLine = m.getStartLine(null);
View Full Code Here

    private IMessage[] analyze() {
        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

                "    \n"
                +
                "\n" +
                "");

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

                "    pass\n" +
                "   \n" +
                "\n" +
                "");

        List<IMessage> messages = TabNanny.analyzeDoc(doc, this.prefs, "", new TestIndentPrefs(true, 4),
                new NullProgressMonitor());
        assertEquals(0, messages.size());

    }
View Full Code Here

                +
                "  string ident\"\"\"\n" +
                "\n" +
                "");

        List<IMessage> messages = TabNanny.analyzeDoc(doc, this.prefs, "", new TestIndentPrefs(true, 4),
                new NullProgressMonitor());
        assertEquals(0, messages.size());

    }
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.