📄 pyaddblockcommenttest.java
字号:
package org.python.pydev.editor.actions;
import org.eclipse.jface.text.Document;
import org.python.pydev.core.docutils.PySelection;
import junit.framework.TestCase;
public class PyAddBlockCommentTest extends TestCase {
public void testBlock() throws Exception {
Document doc = null;
doc = new Document("cc");
new PyAddBlockComment(10, true, true, true).perform(new PySelection(doc, 0,0,0));
PySelectionTest.checkStrEquals("" +
"#---------\r\n" +
"# cc\r\n" +
"#---------", doc.get());
doc = new Document("\tcc");
new PyAddBlockComment(10, true, true, true).perform(new PySelection(doc, 0,0,0));
PySelectionTest.checkStrEquals("" +
"#---------\r\n" +
"#\tcc\r\n" +
"#---------", doc.get());
doc = new Document("class Foo(object):");
new PyAddBlockComment(10, true, true, true).perform(new PySelection(doc, 0,0,0));
PySelectionTest.checkStrEquals("" +
"#---------\r\n" +
"# Foo\r\n" +
"#---------\r\n" +
"class Foo(object):", doc.get());
doc = new Document("class Information( UserDict.UserDict, IInformation ):");
new PyAddBlockComment(10, true, true, true).perform(new PySelection(doc, 0,0,0));
PySelectionTest.checkStrEquals("" +
"#---------\r\n" +
"# Information\r\n" +
"#---------\r\n" +
"class Information( UserDict.UserDict, IInformation ):", doc.get());
doc = new Document("def Information( (UserDict, IInformation) ):");
new PyAddBlockComment(10, true, true, true).perform(new PySelection(doc, 0,0,0));
PySelectionTest.checkStrEquals("" +
"#---------\r\n" +
"# Information\r\n" +
"#---------\r\n" +
"def Information( (UserDict, IInformation) ):", doc.get());
//without class behavior
doc = new Document("class Foo(object):");
new PyAddBlockComment(10, true, false, true).perform(new PySelection(doc, 0,0,0));
PySelectionTest.checkStrEquals("" +
"#---------\r\n" +
"# class Foo(object):\r\n" +
"#---------" +
"", doc.get());
//aligned class
doc = new Document(" class Foo(object):");
new PyAddBlockComment(10, true, true, true).perform(new PySelection(doc, 0,0,0));
PySelectionTest.checkStrEquals("" +
" #-----\r\n" +
" # Foo\r\n" +
" #-----\r\n" +
" class Foo(object):" +
"", doc.get());
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -