[Pydev-cvs] org.python.pydev/tests/org/python/pydev/editor/codecompletion/revisited ASTManagerTest.j
Brought to you by:
fabioz
From: Fabio Z. <fa...@us...> - 2005-05-03 15:31:03
|
Update of /cvsroot/pydev/org.python.pydev/tests/org/python/pydev/editor/codecompletion/revisited In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2458/tests/org/python/pydev/editor/codecompletion/revisited Modified Files: ASTManagerTest.java Log Message: Index: ASTManagerTest.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev/tests/org/python/pydev/editor/codecompletion/revisited/ASTManagerTest.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ASTManagerTest.java 25 Apr 2005 16:50:35 -0000 1.5 --- ASTManagerTest.java 3 May 2005 15:30:50 -0000 1.6 *************** *** 6,11 **** package org.python.pydev.editor.codecompletion.revisited; - import junit.framework.TestCase; - import org.eclipse.jface.text.Document; import org.python.pydev.editor.codecompletion.revisited.modules.CompiledModule; --- 6,9 ---- *************** *** 17,25 **** * @author Fabio Zadrozny */ ! public class ASTManagerTest extends TestCase { private CompletionState state; - private ASTManager manager; - private PythonNature nature; private String token; private int line; --- 15,21 ---- * @author Fabio Zadrozny */ ! public class ASTManagerTest extends CodeCompletionTestsBase { private CompletionState state; private String token; private int line; *************** *** 30,33 **** --- 26,36 ---- + /** + * @return Returns the manager. + */ + private ASTManager getManager() { + return (ASTManager) nature.getAstManager(); + } + /* * @see TestCase#setUp() *************** *** 36,41 **** super.setUp(); CompiledModule.COMPILED_MODULES_ENABLED = false; - manager = new ASTManager(); nature = new PythonNature(); } --- 39,44 ---- super.setUp(); CompiledModule.COMPILED_MODULES_ENABLED = false; nature = new PythonNature(); + nature.setAstManager(new ASTManager()); } *************** *** 64,68 **** doc = new Document(sDoc); state = new CompletionState(line,col, token, nature); ! comps = manager.getCompletionsForToken(doc, state); assertEquals(1, comps.length); assertEquals("makeit", comps[0].getRepresentation()); --- 67,71 ---- doc = new Document(sDoc); state = new CompletionState(line,col, token, nature); ! comps = getManager().getCompletionsForToken(doc, state); assertEquals(1, comps.length); assertEquals("makeit", comps[0].getRepresentation()); *************** *** 85,89 **** doc = new Document(sDoc); state = new CompletionState(line,col, token, nature); ! comps = manager.getCompletionsForToken(doc, state); assertEquals(3, comps.length); assertIsIn("unittest", comps); --- 88,92 ---- doc = new Document(sDoc); state = new CompletionState(line,col, token, nature); ! comps = getManager().getCompletionsForToken(doc, state); assertEquals(3, comps.length); assertIsIn("unittest", comps); *************** *** 110,114 **** doc = new Document(sDoc); state = new CompletionState(line,col, token, nature); ! comps = manager.getCompletionsForToken(doc, state); assertEquals(4, comps.length); assertIsIn("unittest", comps); --- 113,117 ---- doc = new Document(sDoc); state = new CompletionState(line,col, token, nature); ! comps = getManager().getCompletionsForToken(doc, state); assertEquals(4, comps.length); assertIsIn("unittest", comps); *************** *** 136,140 **** doc = new Document(sDoc); state = new CompletionState(line,col, token, nature); ! comps = manager.getCompletionsForToken(doc, state); assertEquals(3, comps.length); assertIsIn("unittest", comps); --- 139,143 ---- doc = new Document(sDoc); state = new CompletionState(line,col, token, nature); ! comps = getManager().getCompletionsForToken(doc, state); assertEquals(3, comps.length); assertIsIn("unittest", comps); *************** *** 156,160 **** doc = new Document(sDoc); state = new CompletionState(line,col, token, nature); ! comps = manager.getCompletionsForToken(doc, state); assertEquals(2, comps.length); assertIsIn("a", comps); --- 159,163 ---- doc = new Document(sDoc); state = new CompletionState(line,col, token, nature); ! comps = getManager().getCompletionsForToken(doc, state); assertEquals(2, comps.length); assertIsIn("a", comps); *************** *** 176,180 **** doc = new Document(sDoc); state = new CompletionState(line,col, token, nature); ! comps = manager.getCompletionsForToken(doc, state); assertEquals(3, comps.length); assertIsIn("foo", comps); --- 179,183 ---- doc = new Document(sDoc); state = new CompletionState(line,col, token, nature); ! comps = getManager().getCompletionsForToken(doc, state); assertEquals(3, comps.length); assertIsIn("foo", comps); *************** *** 201,205 **** doc = new Document(sDoc); state = new CompletionState(line,col, token, nature); ! comps = manager.getCompletionsForToken(doc, state); assertIsIn("first", comps); assertIsIn("last", comps); --- 204,208 ---- doc = new Document(sDoc); state = new CompletionState(line,col, token, nature); ! comps = getManager().getCompletionsForToken(doc, state); assertIsIn("first", comps); assertIsIn("last", comps); *************** *** 217,225 **** doc = new Document(sDoc); state = new CompletionState(line,col, token, nature); ! comps = manager.getCompletionsForToken(doc, state); assertEquals(1, comps.length); } public void testLocals(){ token = ""; --- 220,244 ---- doc = new Document(sDoc); state = new CompletionState(line,col, token, nature); ! comps = getManager().getCompletionsForToken(doc, state); assertEquals(1, comps.length); } + public void testRelative(){ + super.restorePythonPath(false); + token = "Test1"; + line = 1; + col = 0; + sDoc = ""+ + "from testlib.unittest.relative import Test1 \n" + + "\n"; + doc = new Document(sDoc); + state = new CompletionState(line,col, token, nature); + comps = getManager().getCompletionsForToken(doc, state); + assertEquals(1, comps.length); + assertIsIn("test1", comps); + + } + public void testLocals(){ token = ""; *************** *** 231,235 **** doc = new Document(sDoc); state = new CompletionState(line,col, token, nature); ! comps = manager.getCompletionsForToken(doc, state); assertEquals(3, comps.length ); assertIsIn("par1", comps); --- 250,254 ---- doc = new Document(sDoc); state = new CompletionState(line,col, token, nature); ! comps = getManager().getCompletionsForToken(doc, state); assertEquals(3, comps.length ); assertIsIn("par1", comps); *************** *** 247,251 **** doc = new Document(sDoc); state = new CompletionState(line,col, token, nature); ! comps = manager.getCompletionsForToken(doc, state); assertEquals(4, comps.length ); assertIsIn("par1", comps); --- 266,270 ---- doc = new Document(sDoc); state = new CompletionState(line,col, token, nature); ! comps = getManager().getCompletionsForToken(doc, state); assertEquals(4, comps.length ); assertIsIn("par1", comps); *************** *** 265,269 **** doc = new Document(sDoc); state = new CompletionState(line,col, token, nature); ! comps = manager.getCompletionsForToken(doc, state); assertEquals(5, comps.length ); assertIsIn("par1", comps); --- 284,288 ---- doc = new Document(sDoc); state = new CompletionState(line,col, token, nature); ! comps = getManager().getCompletionsForToken(doc, state); assertEquals(5, comps.length ); assertIsIn("par1", comps); *************** *** 285,289 **** doc = new Document(sDoc); state = new CompletionState(line,col, token, nature); ! comps = manager.getCompletionsForToken(doc, state); assertEquals(5, comps.length ); assertIsIn("par1", comps); --- 304,308 ---- doc = new Document(sDoc); state = new CompletionState(line,col, token, nature); ! comps = getManager().getCompletionsForToken(doc, state); assertEquals(5, comps.length ); assertIsIn("par1", comps); |