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

📄 pythonpairmatchertest.java

📁 Python Development Environment (Python IDE plugin for Eclipse). Features editor, code completion, re
💻 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 + -