⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pycommenttest.java

📁 Python Development Environment (Python IDE plugin for Eclipse). Features editor, code completion, re
💻 JAVA
字号:
/*
 * Created on Jul 19, 2006
 * @author Fabio
 */
package org.python.pydev.editor.actions;

import junit.framework.TestCase;

import org.eclipse.jface.text.Document;
import org.python.pydev.core.Tuple;
import org.python.pydev.core.docutils.PySelection;

public class PyCommentTest extends TestCase {

    protected void setUp() throws Exception {
        super.setUp();
    }

    protected void tearDown() throws Exception {
        super.tearDown();
    }

    
    public void testComment() throws Exception {
        Document doc = new Document(
                "a\n" +
                "\n" +
                "\n");
        PySelection ps = new PySelection(doc, 0, 0, doc.getLength());
        assertEquals(new Tuple<Integer, Integer>(0,5), new PyComment().perform(ps));
        
        String expected = "#a\n" +
                          "#\n" +
                          "\n";
        assertEquals(expected, doc.get());
        
    }
    
    
    public void testComment2() throws Exception {
        Document doc = new Document(
                "a\r" +
                "\r" +
                "\r");
        PySelection ps = new PySelection(doc, 0, 0, doc.getLength());
        assertEquals(new Tuple<Integer, Integer>(0,5), new PyComment().perform(ps));
        
        String expected =   "#a\r" +
                            "#\r" +
                            "\r";
        assertEquals(expected, doc.get());
        
    }
    

    public void testComment3() throws Exception {
        Document doc = new Document(
                "a\r\n" +
                "\r\n" +
                "\r\n");
        PySelection ps = new PySelection(doc, 0, 0, doc.getLength());
        assertEquals(new Tuple<Integer, Integer>(0,7), new PyComment().perform(ps));
        
        String expected =   "#a\r\n" +
                            "#\r\n" +
                            "\r\n";
        assertEquals(expected, doc.get());
        
    }
    public void testComment4() throws Exception {
        Document doc = new Document(
                "a\r\n" +
                "b");
        PySelection ps = new PySelection(doc, 0, 0, doc.getLength());
        assertEquals(new Tuple<Integer, Integer>(0,6),new PyComment().perform(ps));
        
        String expected =   "#a\r\n" +
                            "#b";
        assertEquals(expected, doc.get());
        
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -