📄 pythonpairmatchertest.java
字号:
package org.python.copiedfromeclipsesrc;
import org.eclipse.jface.text.Document;
import junit.framework.TestCase;
public class PythonPairMatcherTest extends TestCase {
public static void main(String[] args) {
junit.textui.TestRunner.run(PythonPairMatcherTest.class);
}
protected void setUp() throws Exception {
super.setUp();
}
protected void tearDown() throws Exception {
super.tearDown();
}
public void testMatch() throws Exception {
PythonPairMatcher matcher = getMatcher();
String s = "test (";
assertEquals(5, matcher.searchForOpeningPeer(s.length(), '(', ')', new Document(s)));
s = "test ";
assertEquals(-1, matcher.searchForOpeningPeer(s.length(), '(', ')', new Document(s)));
s = "test () ";
assertEquals(-1, matcher.searchForOpeningPeer(s.length(), '(', ')', new Document(s)));
}
public void testMatch1() throws Exception {
PythonPairMatcher matcher = getMatcher();
String s = "\ntest ('[#') ";
assertEquals(-1, matcher.searchForAnyOpeningPeer(s.length(), new Document(s)));
}
public void testMatch2() throws Exception {
PythonPairMatcher matcher = getMatcher();
String s = "\ntest ('''\n[#''') ";
assertEquals(-1, matcher.searchForAnyOpeningPeer(s.length(), new Document(s)));
}
private PythonPairMatcher getMatcher() {
return new PythonPairMatcher(new char[]{'(', ')', '[', ']'});
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -