[Pydev-cvs] org.python.pydev.refactoring/tests/org/python/pydev/refactoring/tests/adapter CodeComp
Brought to you by:
fabioz
Update of /cvsroot/pydev/org.python.pydev.refactoring/tests/org/python/pydev/refactoring/tests/adapter In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21605/tests/org/python/pydev/refactoring/tests/adapter Modified Files: CodeCompletionASTManagerStub.java AllTests.java FunctionDefAdapterTestSuite.java FunctionDefAdapterTestCase.java ClassDefAdapterTestSuite.java ClassDefAdapterTestCase.java ModuleAdapterTestConfig.java HierarchyTestCase.java ModuleAdapterTestSuite.java PythonNatureStub.java ModuleAdapterTestCase.java Log Message: Synching to latest changes: Pydev <ul> <li><strong>Editor</strong>: Cursor settings no longer overridden</li> <li><strong>Code-completion</strong>: If __all__ is defined with runtime elements (and not only in a single assign statement), it's ignored for code-completion purposes</li> <li><strong>Debugger</strong>: Pythonpath the same in debug and regular modes (sys.path[0] is the same directory as the file run)</li> <li><strong>Debugger</strong>: Persist choices done in the debugger when files from the debugger are not found</li> <li><strong>Interpreter config</strong>: "email" automatically added to the "forced builtins"</li> <li><strong>Parser</strong>: Correctly recognizing absolute import with 3 or more levels</li> <li><strong>Syntax check</strong>: Option to do only on active editor</li> </ul> Also: tabs changed for spaces Index: ClassDefAdapterTestSuite.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.refactoring/tests/org/python/pydev/refactoring/tests/adapter/ClassDefAdapterTestSuite.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ClassDefAdapterTestSuite.java 20 Oct 2007 19:31:00 -0000 1.4 --- ClassDefAdapterTestSuite.java 27 Sep 2008 20:00:48 -0000 1.5 *************** *** 14,30 **** public class ClassDefAdapterTestSuite extends AbstractIOTestSuite { ! public static Test suite() { ! TESTDIR = "tests" + File.separator + "python" + File.separator + "adapter" + File.separator + "classdef"; ! ClassDefAdapterTestSuite testSuite = new ClassDefAdapterTestSuite(); ! testSuite.createTests(); testSuite.addTest(new HierarchyTestCase("testHierarchyWithBuiltins")); ! return testSuite; ! } ! @Override ! protected IInputOutputTestCase createTestCase(String testCaseName) { ! return new ClassDefAdapterTestCase(testCaseName); ! } } --- 14,30 ---- public class ClassDefAdapterTestSuite extends AbstractIOTestSuite { ! public static Test suite() { ! TESTDIR = "tests" + File.separator + "python" + File.separator + "adapter" + File.separator + "classdef"; ! ClassDefAdapterTestSuite testSuite = new ClassDefAdapterTestSuite(); ! testSuite.createTests(); testSuite.addTest(new HierarchyTestCase("testHierarchyWithBuiltins")); ! return testSuite; ! } ! @Override ! protected IInputOutputTestCase createTestCase(String testCaseName) { ! return new ClassDefAdapterTestCase(testCaseName); ! } } Index: HierarchyTestCase.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.refactoring/tests/org/python/pydev/refactoring/tests/adapter/HierarchyTestCase.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** HierarchyTestCase.java 5 Feb 2008 13:07:01 -0000 1.7 --- HierarchyTestCase.java 27 Sep 2008 20:00:48 -0000 1.8 *************** *** 71,76 **** HashSet<String> actual = new HashSet<String>(); for (IClassDefAdapter adapter : baseClasses) { ! actual.add(adapter.getName()); ! } HashSet<String> expected = new HashSet<String>(); expected.add("MyList2"); --- 71,76 ---- HashSet<String> actual = new HashSet<String>(); for (IClassDefAdapter adapter : baseClasses) { ! actual.add(adapter.getName()); ! } HashSet<String> expected = new HashSet<String>(); expected.add("MyList2"); *************** *** 78,82 **** expected.add("MyListBase"); ! assertEquals(expected, actual); } --- 78,82 ---- expected.add("MyListBase"); ! assertEquals(expected, actual); } Index: CodeCompletionASTManagerStub.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.refactoring/tests/org/python/pydev/refactoring/tests/adapter/CodeCompletionASTManagerStub.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** CodeCompletionASTManagerStub.java 31 Jul 2008 01:48:12 -0000 1.4 --- CodeCompletionASTManagerStub.java 27 Sep 2008 20:00:48 -0000 1.5 *************** *** 26,153 **** public class CodeCompletionASTManagerStub implements ICodeCompletionASTManager { ! public void changePythonPath(String pythonpath, IProject project, ! IProgressMonitor monitor, String defaultSelectedInterpreter) { ! throw new RuntimeException("Not implemented"); ! } ! public Tuple3<IModule, String, IToken> findOnImportedMods( ! ICompletionState state, IModule current) ! throws CompletionRecursionException { ! throw new RuntimeException("Not implemented"); ! } ! public Tuple3<IModule, String, IToken> findOnImportedMods( ! IToken[] importedModules, ICompletionState state, ! String currentModuleName) throws CompletionRecursionException { ! throw new RuntimeException("Not implemented"); ! } ! public IToken[] findTokensOnImportedMods(IToken[] importedModules, ! ICompletionState state, IModule current) ! throws CompletionRecursionException { ! throw new RuntimeException("Not implemented"); ! } ! public List<IToken> getBuiltinCompletions(ICompletionState state, ! List<IToken> completions) { ! throw new RuntimeException("Not implemented"); ! } ! public IToken[] getCompletionsForImport(ImportInfo original, ! ICompletionRequest request) throws CompletionRecursionException { ! throw new RuntimeException("Not implemented"); ! } ! public IToken[] getCompletionsForModule(IModule module, ! ICompletionState state) throws CompletionRecursionException { ! return new IToken[] { ! new SourceToken(new Name("True", Name.Store), "True", "", "", ! "__builtin__"), ! new SourceToken(new Name("False", Name.Store), "False", "", "", ! "__builtin__"), }; ! } ! public IToken[] getCompletionsForModule(IModule module, ! ICompletionState state, boolean searchSameLevelMods) ! throws CompletionRecursionException { ! throw new RuntimeException("Not implemented"); ! } ! public IToken[] getCompletionsForModule(IModule module, ! ICompletionState state, boolean searchSameLevelMods, ! boolean lookForArgumentCompletion) ! throws CompletionRecursionException { ! throw new RuntimeException("Not implemented"); ! } ! public IToken[] getCompletionsForToken(File file, IDocument doc, ! ICompletionState state) throws CompletionRecursionException { ! throw new RuntimeException("Not implemented"); ! } ! public IToken[] getCompletionsForToken(IDocument doc, ICompletionState state) ! throws CompletionRecursionException { ! throw new RuntimeException("Not implemented"); ! } ! public List<IToken> getCompletionsForWildImport(ICompletionState state, ! IModule current, List<IToken> completions, IToken wildImport) { ! throw new RuntimeException("Not implemented"); ! } ! public List<IToken> getGlobalCompletions(IToken[] globalTokens, ! IToken[] importedModules, IToken[] wildImportedModules, ! ICompletionState state, IModule current) { ! throw new RuntimeException("Not implemented"); ! } ! public IModule getModule(String name, IPythonNature nature, ! boolean dontSearchInit, boolean lookingForRelative) { ! throw new RuntimeException("Not implemented"); ! } ! public IModule getModule(String name, IPythonNature nature, ! boolean dontSearchInit) { ! throw new RuntimeException("Not implemented"); ! } ! public IModulesManager getModulesManager() { ! throw new RuntimeException("Not implemented"); ! } ! public IPythonNature getNature() { ! throw new RuntimeException("Not implemented"); ! } ! public IToken getRepInModule(IModule module, String tokName, ! IPythonNature nature) throws CompletionRecursionException { ! throw new RuntimeException("Not implemented"); ! } ! public void rebuildModule(File file, IDocument doc, IProject project, ! IProgressMonitor monitor, IPythonNature nature) { ! throw new RuntimeException("Not implemented"); ! } ! public void removeModule(File file, IProject project, ! IProgressMonitor monitor) { ! throw new RuntimeException("Not implemented"); ! } ! public IToken resolveImport(ICompletionState state, IToken imported) ! throws CompletionRecursionException { ! throw new RuntimeException("Not implemented"); ! } ! public void setProject(IProject project, IPythonNature nature, boolean restoreDeltas) { ! throw new RuntimeException("Not implemented"); ! } ! public void getCompletionsForClassInLocalScope(IModule module, ! ICompletionState state, boolean searchSameLevelMods, ! boolean lookForArgumentCompletion, List<String> lookForClass, ! HashSet<IToken> hashSet) throws CompletionRecursionException { ! throw new RuntimeException("Not implemented"); ! } } --- 26,153 ---- public class CodeCompletionASTManagerStub implements ICodeCompletionASTManager { ! public void changePythonPath(String pythonpath, IProject project, ! IProgressMonitor monitor, String defaultSelectedInterpreter) { ! throw new RuntimeException("Not implemented"); ! } ! public Tuple3<IModule, String, IToken> findOnImportedMods( ! ICompletionState state, IModule current) ! throws CompletionRecursionException { ! throw new RuntimeException("Not implemented"); ! } ! public Tuple3<IModule, String, IToken> findOnImportedMods( ! IToken[] importedModules, ICompletionState state, ! String currentModuleName) throws CompletionRecursionException { ! throw new RuntimeException("Not implemented"); ! } ! public IToken[] findTokensOnImportedMods(IToken[] importedModules, ! ICompletionState state, IModule current) ! throws CompletionRecursionException { ! throw new RuntimeException("Not implemented"); ! } ! public List<IToken> getBuiltinCompletions(ICompletionState state, ! List<IToken> completions) { ! throw new RuntimeException("Not implemented"); ! } ! public IToken[] getCompletionsForImport(ImportInfo original, ! ICompletionRequest request) throws CompletionRecursionException { ! throw new RuntimeException("Not implemented"); ! } ! public IToken[] getCompletionsForModule(IModule module, ! ICompletionState state) throws CompletionRecursionException { ! return new IToken[] { ! new SourceToken(new Name("True", Name.Store), "True", "", "", ! "__builtin__"), ! new SourceToken(new Name("False", Name.Store), "False", "", "", ! "__builtin__"), }; ! } ! public IToken[] getCompletionsForModule(IModule module, ! ICompletionState state, boolean searchSameLevelMods) ! throws CompletionRecursionException { ! throw new RuntimeException("Not implemented"); ! } ! public IToken[] getCompletionsForModule(IModule module, ! ICompletionState state, boolean searchSameLevelMods, ! boolean lookForArgumentCompletion) ! throws CompletionRecursionException { ! throw new RuntimeException("Not implemented"); ! } ! public IToken[] getCompletionsForToken(File file, IDocument doc, ! ICompletionState state) throws CompletionRecursionException { ! throw new RuntimeException("Not implemented"); ! } ! public IToken[] getCompletionsForToken(IDocument doc, ICompletionState state) ! throws CompletionRecursionException { ! throw new RuntimeException("Not implemented"); ! } ! public boolean getCompletionsForWildImport(ICompletionState state, ! IModule current, List<IToken> completions, IToken wildImport) { ! throw new RuntimeException("Not implemented"); ! } ! public List<IToken> getGlobalCompletions(IToken[] globalTokens, ! IToken[] importedModules, IToken[] wildImportedModules, ! ICompletionState state, IModule current) { ! throw new RuntimeException("Not implemented"); ! } ! public IModule getModule(String name, IPythonNature nature, ! boolean dontSearchInit, boolean lookingForRelative) { ! throw new RuntimeException("Not implemented"); ! } ! public IModule getModule(String name, IPythonNature nature, ! boolean dontSearchInit) { ! throw new RuntimeException("Not implemented"); ! } ! public IModulesManager getModulesManager() { ! throw new RuntimeException("Not implemented"); ! } ! public IPythonNature getNature() { ! throw new RuntimeException("Not implemented"); ! } ! public IToken getRepInModule(IModule module, String tokName, ! IPythonNature nature) throws CompletionRecursionException { ! throw new RuntimeException("Not implemented"); ! } ! public void rebuildModule(File file, IDocument doc, IProject project, ! IProgressMonitor monitor, IPythonNature nature) { ! throw new RuntimeException("Not implemented"); ! } ! public void removeModule(File file, IProject project, ! IProgressMonitor monitor) { ! throw new RuntimeException("Not implemented"); ! } ! public IToken resolveImport(ICompletionState state, IToken imported) ! throws CompletionRecursionException { ! throw new RuntimeException("Not implemented"); ! } ! public void setProject(IProject project, IPythonNature nature, boolean restoreDeltas) { ! throw new RuntimeException("Not implemented"); ! } ! public void getCompletionsForClassInLocalScope(IModule module, ! ICompletionState state, boolean searchSameLevelMods, ! boolean lookForArgumentCompletion, List<String> lookForClass, ! HashSet<IToken> hashSet) throws CompletionRecursionException { ! throw new RuntimeException("Not implemented"); ! } } Index: ModuleAdapterTestConfig.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.refactoring/tests/org/python/pydev/refactoring/tests/adapter/ModuleAdapterTestConfig.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ModuleAdapterTestConfig.java 20 Oct 2007 19:31:00 -0000 1.2 --- ModuleAdapterTestConfig.java 27 Sep 2008 20:00:48 -0000 1.3 *************** *** 10,14 **** public class ModuleAdapterTestConfig { ! List<String> resolveNames = new ArrayList<String>(); } --- 10,14 ---- public class ModuleAdapterTestConfig { ! List<String> resolveNames = new ArrayList<String>(); } Index: FunctionDefAdapterTestSuite.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.refactoring/tests/org/python/pydev/refactoring/tests/adapter/FunctionDefAdapterTestSuite.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** FunctionDefAdapterTestSuite.java 20 Oct 2007 19:31:00 -0000 1.3 --- FunctionDefAdapterTestSuite.java 27 Sep 2008 20:00:48 -0000 1.4 *************** *** 14,29 **** public class FunctionDefAdapterTestSuite extends AbstractIOTestSuite { ! public static Test suite() { ! TESTDIR = "tests" + File.separator + "python" + File.separator + "adapter" + File.separator + "functiondef"; ! FunctionDefAdapterTestSuite testSuite = new FunctionDefAdapterTestSuite(); ! testSuite.createTests(); ! return testSuite; ! } ! @Override ! protected IInputOutputTestCase createTestCase(String testCaseName) { ! return new FunctionDefAdapterTestCase(testCaseName); ! } } --- 14,29 ---- public class FunctionDefAdapterTestSuite extends AbstractIOTestSuite { ! public static Test suite() { ! TESTDIR = "tests" + File.separator + "python" + File.separator + "adapter" + File.separator + "functiondef"; ! FunctionDefAdapterTestSuite testSuite = new FunctionDefAdapterTestSuite(); ! testSuite.createTests(); ! return testSuite; ! } ! @Override ! protected IInputOutputTestCase createTestCase(String testCaseName) { ! return new FunctionDefAdapterTestCase(testCaseName); ! } } Index: ModuleAdapterTestSuite.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.refactoring/tests/org/python/pydev/refactoring/tests/adapter/ModuleAdapterTestSuite.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ModuleAdapterTestSuite.java 20 Oct 2007 19:31:00 -0000 1.3 --- ModuleAdapterTestSuite.java 27 Sep 2008 20:00:48 -0000 1.4 *************** *** 14,29 **** public class ModuleAdapterTestSuite extends AbstractIOTestSuite { ! public static Test suite() { ! TESTDIR = "tests" + File.separator + "python" + File.separator + "adapter" + File.separator + "module"; ! ModuleAdapterTestSuite testSuite = new ModuleAdapterTestSuite(); ! testSuite.createTests(); ! return testSuite; ! } ! @Override ! protected IInputOutputTestCase createTestCase(String testCaseName) { ! return new ModuleAdapterTestCase(testCaseName); ! } } --- 14,29 ---- public class ModuleAdapterTestSuite extends AbstractIOTestSuite { ! public static Test suite() { ! TESTDIR = "tests" + File.separator + "python" + File.separator + "adapter" + File.separator + "module"; ! ModuleAdapterTestSuite testSuite = new ModuleAdapterTestSuite(); ! testSuite.createTests(); ! return testSuite; ! } ! @Override ! protected IInputOutputTestCase createTestCase(String testCaseName) { ! return new ModuleAdapterTestCase(testCaseName); ! } } Index: FunctionDefAdapterTestCase.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.refactoring/tests/org/python/pydev/refactoring/tests/adapter/FunctionDefAdapterTestCase.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** FunctionDefAdapterTestCase.java 20 Oct 2007 19:31:00 -0000 1.5 --- FunctionDefAdapterTestCase.java 27 Sep 2008 20:00:48 -0000 1.6 *************** *** 16,56 **** public class FunctionDefAdapterTestCase extends AbstractIOTestCase { ! public FunctionDefAdapterTestCase(String name) { ! super(name); ! } ! @Override ! public void runTest() throws Throwable { ! StringBuffer buffer = new StringBuffer(); ! ModuleAdapter module = VisitorFactory.createModuleAdapter(null, null, new Document(getSource()), new PythonNatureStub()); ! List<IClassDefAdapter> classes = module.getClasses(); ! assertTrue(classes.size() > 0); ! buffer.append("# ClassName FunctionName hasArg hasVarArg hasKwArg ArgumentsOnly\n"); ! for (IClassDefAdapter adapter : module.getClasses()) { ! printFunction(buffer, adapter); ! } ! this.setTestGenerated(buffer.toString().trim()); ! assertEquals(getExpected(), getGenerated()); ! } ! private void printFunction(StringBuffer buffer, IClassDefAdapter adapter) { ! final String DOUBLETAB = " "; ! buffer.append("# " + adapter.getName() + "\n"); ! for (FunctionDefAdapter function : adapter.getFunctions()) { ! buffer.append("# "); ! buffer.append(function.getName() + DOUBLETAB + function.getArguments().hasArg() + DOUBLETAB ! + function.getArguments().hasVarArg() + DOUBLETAB + function.getArguments().hasKwArg() + DOUBLETAB ! + function.getArguments().getArgOnly()); ! buffer.append("\n"); ! } ! buffer.append("\n"); ! } ! @Override ! public String getExpected() { ! return getResult(); ! } } --- 16,56 ---- public class FunctionDefAdapterTestCase extends AbstractIOTestCase { ! public FunctionDefAdapterTestCase(String name) { ! super(name); ! } ! @Override ! public void runTest() throws Throwable { ! StringBuffer buffer = new StringBuffer(); ! ModuleAdapter module = VisitorFactory.createModuleAdapter(null, null, new Document(getSource()), new PythonNatureStub()); ! List<IClassDefAdapter> classes = module.getClasses(); ! assertTrue(classes.size() > 0); ! buffer.append("# ClassName FunctionName hasArg hasVarArg hasKwArg ArgumentsOnly\n"); ! for (IClassDefAdapter adapter : module.getClasses()) { ! printFunction(buffer, adapter); ! } ! this.setTestGenerated(buffer.toString().trim()); ! assertEquals(getExpected(), getGenerated()); ! } ! private void printFunction(StringBuffer buffer, IClassDefAdapter adapter) { ! final String DOUBLETAB = " "; ! buffer.append("# " + adapter.getName() + "\n"); ! for (FunctionDefAdapter function : adapter.getFunctions()) { ! buffer.append("# "); ! buffer.append(function.getName() + DOUBLETAB + function.getArguments().hasArg() + DOUBLETAB ! + function.getArguments().hasVarArg() + DOUBLETAB + function.getArguments().hasKwArg() + DOUBLETAB ! + function.getArguments().getArgOnly()); ! buffer.append("\n"); ! } ! buffer.append("\n"); ! } ! @Override ! public String getExpected() { ! return getResult(); ! } } Index: PythonNatureStub.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.refactoring/tests/org/python/pydev/refactoring/tests/adapter/PythonNatureStub.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** PythonNatureStub.java 28 Feb 2008 01:44:42 -0000 1.4 --- PythonNatureStub.java 27 Sep 2008 20:00:48 -0000 1.5 *************** *** 20,138 **** public class PythonNatureStub implements IPythonNature{ ! public ICodeCompletionASTManager getAstManager() { ! return new CodeCompletionASTManagerStub(); ! } ! public IToken[] getBuiltinCompletions() { ! throw new RuntimeException("Not implemented"); ! } ! public IModule getBuiltinMod() { ! throw new RuntimeException("Not implemented"); ! } ! public File getCompletionsCacheDir() { ! throw new RuntimeException("Not implemented"); ! } ! public String getDefaultVersion() { ! throw new RuntimeException("Not implemented"); ! } ! public IPythonPathNature getPythonPathNature() { ! throw new RuntimeException("Not implemented"); ! } ! public int getRelatedId() throws CoreException { ! throw new RuntimeException("Not implemented"); ! } ! public IInterpreterManager getRelatedInterpreterManager() { ! throw new RuntimeException("Not implemented"); ! } ! public String getVersion() throws CoreException { ! throw new RuntimeException("Not implemented"); ! } ! public boolean isJython() throws CoreException { ! throw new RuntimeException("Not implemented"); ! } ! public boolean isPython() throws CoreException { ! throw new RuntimeException("Not implemented"); ! } ! public void rebuildPath() { ! throw new RuntimeException("Not implemented"); ! } ! public void rebuildPath(String defaultSelectedInterpreter, IProgressMonitor monitor) { ! throw new RuntimeException("Not implemented"); ! } ! public String resolveModule(File file) { ! throw new RuntimeException("Not implemented"); ! } ! public void saveAstManager() { ! throw new RuntimeException("Not implemented"); ! } ! public void setBuiltinCompletions(IToken[] toks) { ! throw new RuntimeException("Not implemented"); ! } ! public void setBuiltinMod(IModule mod) { ! throw new RuntimeException("Not implemented"); ! } ! public void setVersion(String version) throws CoreException { ! throw new RuntimeException("Not implemented"); ! } ! public void configure() throws CoreException { ! throw new RuntimeException("Not implemented"); ! } ! public void deconfigure() throws CoreException { ! throw new RuntimeException("Not implemented"); ! } ! public IProject getProject() { ! throw new RuntimeException("Not implemented"); ! } ! public void setProject(IProject project) { ! throw new RuntimeException("Not implemented"); ! } ! public int getGrammarVersion() { ! throw new RuntimeException("Not implemented"); ! } ! public void endRequests() { ! throw new RuntimeException("Not implemented"); ! } ! public boolean isResourceInPythonpath(IResource resource) { ! throw new RuntimeException("Not implemented"); ! } ! public boolean isResourceInPythonpath(String resource) { ! throw new RuntimeException("Not implemented"); ! } ! public String resolveModule(String fileAbsolutePath) { ! throw new RuntimeException("Not implemented"); ! } ! public String resolveModule(IResource resource) { ! throw new RuntimeException("Not implemented"); ! } ! public boolean startRequests() { ! throw new RuntimeException("Not implemented"); ! } } --- 20,138 ---- public class PythonNatureStub implements IPythonNature{ ! public ICodeCompletionASTManager getAstManager() { ! return new CodeCompletionASTManagerStub(); ! } ! public IToken[] getBuiltinCompletions() { ! throw new RuntimeException("Not implemented"); ! } ! public IModule getBuiltinMod() { ! throw new RuntimeException("Not implemented"); ! } ! public File getCompletionsCacheDir() { ! throw new RuntimeException("Not implemented"); ! } ! public String getDefaultVersion() { ! throw new RuntimeException("Not implemented"); ! } ! public IPythonPathNature getPythonPathNature() { ! throw new RuntimeException("Not implemented"); ! } ! public int getRelatedId() throws CoreException { ! throw new RuntimeException("Not implemented"); ! } ! public IInterpreterManager getRelatedInterpreterManager() { ! throw new RuntimeException("Not implemented"); ! } ! public String getVersion() throws CoreException { ! throw new RuntimeException("Not implemented"); ! } ! public boolean isJython() throws CoreException { ! throw new RuntimeException("Not implemented"); ! } ! public boolean isPython() throws CoreException { ! throw new RuntimeException("Not implemented"); ! } ! public void rebuildPath() { ! throw new RuntimeException("Not implemented"); ! } ! public void rebuildPath(String defaultSelectedInterpreter, IProgressMonitor monitor) { ! throw new RuntimeException("Not implemented"); ! } ! public String resolveModule(File file) { ! throw new RuntimeException("Not implemented"); ! } ! public void saveAstManager() { ! throw new RuntimeException("Not implemented"); ! } ! public void setBuiltinCompletions(IToken[] toks) { ! throw new RuntimeException("Not implemented"); ! } ! public void setBuiltinMod(IModule mod) { ! throw new RuntimeException("Not implemented"); ! } ! public void setVersion(String version) throws CoreException { ! throw new RuntimeException("Not implemented"); ! } ! public void configure() throws CoreException { ! throw new RuntimeException("Not implemented"); ! } ! public void deconfigure() throws CoreException { ! throw new RuntimeException("Not implemented"); ! } ! public IProject getProject() { ! throw new RuntimeException("Not implemented"); ! } ! public void setProject(IProject project) { ! throw new RuntimeException("Not implemented"); ! } ! public int getGrammarVersion() { ! throw new RuntimeException("Not implemented"); ! } ! public void endRequests() { ! throw new RuntimeException("Not implemented"); ! } ! public boolean isResourceInPythonpath(IResource resource) { ! throw new RuntimeException("Not implemented"); ! } ! public boolean isResourceInPythonpath(String resource) { ! throw new RuntimeException("Not implemented"); ! } ! public String resolveModule(String fileAbsolutePath) { ! throw new RuntimeException("Not implemented"); ! } ! public String resolveModule(IResource resource) { ! throw new RuntimeException("Not implemented"); ! } ! public boolean startRequests() { ! throw new RuntimeException("Not implemented"); ! } } Index: AllTests.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.refactoring/tests/org/python/pydev/refactoring/tests/adapter/AllTests.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** AllTests.java 20 Oct 2007 19:31:00 -0000 1.3 --- AllTests.java 27 Sep 2008 20:00:48 -0000 1.4 *************** *** 10,22 **** public class AllTests { ! public static Test suite() { ! TestSuite suite = new TestSuite("Test for org.python.pydev.refactoring.tests.adapter"); ! // $JUnit-BEGIN$ ! suite.addTest(ClassDefAdapterTestSuite.suite()); ! suite.addTest(FunctionDefAdapterTestSuite.suite()); ! suite.addTest(ModuleAdapterTestSuite.suite()); ! // $JUnit-END$ ! return suite; ! } } --- 10,22 ---- public class AllTests { ! public static Test suite() { ! TestSuite suite = new TestSuite("Test for org.python.pydev.refactoring.tests.adapter"); ! // $JUnit-BEGIN$ ! suite.addTest(ClassDefAdapterTestSuite.suite()); ! suite.addTest(FunctionDefAdapterTestSuite.suite()); ! suite.addTest(ModuleAdapterTestSuite.suite()); ! // $JUnit-END$ ! return suite; ! } } Index: ClassDefAdapterTestCase.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.refactoring/tests/org/python/pydev/refactoring/tests/adapter/ClassDefAdapterTestCase.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** ClassDefAdapterTestCase.java 5 Feb 2008 13:07:01 -0000 1.6 --- ClassDefAdapterTestCase.java 27 Sep 2008 20:00:48 -0000 1.7 *************** *** 16,80 **** public class ClassDefAdapterTestCase extends AbstractIOTestCase { ! private CompletionEnvironmentSetupHelper setupHelper; public ClassDefAdapterTestCase(String name) { ! super(name); ! } ! @Override ! public void runTest() throws Throwable { setupHelper = new CompletionEnvironmentSetupHelper(); setupHelper.setupEnv(); try{ ! StringBuffer buffer = new StringBuffer(); ! ModuleAdapter module = setupHelper.createModuleAdapter(this); ! List<IClassDefAdapter> classes = module.getClasses(); ! assertTrue(classes.size() > 0); ! for (IClassDefAdapter adapter : classes) { ! printBaseClass(buffer, adapter); ! ! //sort them as the order is not actually guaranteed! ! IClassDefAdapter[] baseClasses = adapter.getBaseClasses().toArray(new IClassDefAdapter[0]); ! Arrays.sort(baseClasses, new Comparator<IClassDefAdapter>(){ public int compare(IClassDefAdapter o1, IClassDefAdapter o2) { return o1.getName().compareTo(o2.getName()); }} ! ); ! for (IClassDefAdapter base : baseClasses) { ! buffer.append("## " + adapter.getName()); ! printBaseDefClass(buffer, base); ! } ! } ! this.setTestGenerated(buffer.toString().trim()); ! assertEquals(getExpected(), getGenerated()); }finally{ setupHelper.tearDownEnv(); } ! } ! private void printBaseDefClass(StringBuffer buffer, IClassDefAdapter base) { ! buffer.append(" Base: " + base.getName()); ! buffer.append("\n"); ! } ! private void printBaseClass(StringBuffer buffer, IClassDefAdapter adapter) { ! buffer.append("# " + adapter.getName()); ! for (String name : adapter.getBaseClassNames()) { ! buffer.append(" " + name); ! } ! buffer.append("\n"); ! } ! @Override ! public String getExpected() { ! return getResult(); ! } } --- 16,80 ---- public class ClassDefAdapterTestCase extends AbstractIOTestCase { ! private CompletionEnvironmentSetupHelper setupHelper; public ClassDefAdapterTestCase(String name) { ! super(name); ! } ! @Override ! public void runTest() throws Throwable { setupHelper = new CompletionEnvironmentSetupHelper(); setupHelper.setupEnv(); try{ ! StringBuffer buffer = new StringBuffer(); ! ModuleAdapter module = setupHelper.createModuleAdapter(this); ! List<IClassDefAdapter> classes = module.getClasses(); ! assertTrue(classes.size() > 0); ! for (IClassDefAdapter adapter : classes) { ! printBaseClass(buffer, adapter); ! ! //sort them as the order is not actually guaranteed! ! IClassDefAdapter[] baseClasses = adapter.getBaseClasses().toArray(new IClassDefAdapter[0]); ! Arrays.sort(baseClasses, new Comparator<IClassDefAdapter>(){ public int compare(IClassDefAdapter o1, IClassDefAdapter o2) { return o1.getName().compareTo(o2.getName()); }} ! ); ! for (IClassDefAdapter base : baseClasses) { ! buffer.append("## " + adapter.getName()); ! printBaseDefClass(buffer, base); ! } ! } ! this.setTestGenerated(buffer.toString().trim()); ! assertEquals(getExpected(), getGenerated()); }finally{ setupHelper.tearDownEnv(); } ! } ! private void printBaseDefClass(StringBuffer buffer, IClassDefAdapter base) { ! buffer.append(" Base: " + base.getName()); ! buffer.append("\n"); ! } ! private void printBaseClass(StringBuffer buffer, IClassDefAdapter adapter) { ! buffer.append("# " + adapter.getName()); ! for (String name : adapter.getBaseClassNames()) { ! buffer.append(" " + name); ! } ! buffer.append("\n"); ! } ! @Override ! public String getExpected() { ! return getResult(); ! } } Index: ModuleAdapterTestCase.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.refactoring/tests/org/python/pydev/refactoring/tests/adapter/ModuleAdapterTestCase.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ModuleAdapterTestCase.java 20 Oct 2007 19:31:00 -0000 1.4 --- ModuleAdapterTestCase.java 27 Sep 2008 20:00:48 -0000 1.5 *************** *** 15,63 **** public class ModuleAdapterTestCase extends AbstractIOTestCase { ! public ModuleAdapterTestCase(String name) { ! super(name); ! } ! @Override ! public void runTest() throws Throwable { ! StringBuffer buffer = new StringBuffer(); ! ModuleAdapterTestConfig config = null; ! XStream xstream = new XStream(); ! xstream.alias("config", ModuleAdapterTestConfig.class); ! ModuleAdapter module = VisitorFactory.createModuleAdapter(null, null, new Document(getSource()), new PythonNatureStub()); ! if (getConfig().length() > 0) { ! config = (ModuleAdapterTestConfig) xstream.fromXML(getConfig()); ! } else { ! fail("Could not unserialize configuration"); ! return; /* explicit return, fail should already abort */ ! } ! for (String identifier : config.resolveNames) { ! for (FQIdentifier id : module.resolveFullyQualified(identifier)) { ! buffer.append("# " + identifier + " -> " + id.getFQName()); ! buffer.append("\n"); ! } ! } ! buffer.append("# Imported regular modules (Alias, Realname)"); ! for (String aliasModule : module.getRegularImportedModules().keySet()) { ! buffer.append("\n# " + aliasModule + " " + module.getRegularImportedModules().get(aliasModule)); ! } ! buffer.append("\n"); ! buffer.append("# AliasToIdentifier (Module, Realname, Alias)"); ! for (FQIdentifier identifier : module.getAliasToIdentifier()) { ! buffer.append("\n# " + identifier.getModule() + " " + identifier.getRealName() + " " + identifier.getAlias()); ! } ! this.setTestGenerated(buffer.toString().trim()); ! assertEquals(getExpected(), getGenerated()); ! } ! @Override ! public String getExpected() { ! return getResult(); ! } } --- 15,63 ---- public class ModuleAdapterTestCase extends AbstractIOTestCase { ! public ModuleAdapterTestCase(String name) { ! super(name); ! } ! @Override ! public void runTest() throws Throwable { ! StringBuffer buffer = new StringBuffer(); ! ModuleAdapterTestConfig config = null; ! XStream xstream = new XStream(); ! xstream.alias("config", ModuleAdapterTestConfig.class); ! ModuleAdapter module = VisitorFactory.createModuleAdapter(null, null, new Document(getSource()), new PythonNatureStub()); ! if (getConfig().length() > 0) { ! config = (ModuleAdapterTestConfig) xstream.fromXML(getConfig()); ! } else { ! fail("Could not unserialize configuration"); ! return; /* explicit return, fail should already abort */ ! } ! for (String identifier : config.resolveNames) { ! for (FQIdentifier id : module.resolveFullyQualified(identifier)) { ! buffer.append("# " + identifier + " -> " + id.getFQName()); ! buffer.append("\n"); ! } ! } ! buffer.append("# Imported regular modules (Alias, Realname)"); ! for (String aliasModule : module.getRegularImportedModules().keySet()) { ! buffer.append("\n# " + aliasModule + " " + module.getRegularImportedModules().get(aliasModule)); ! } ! buffer.append("\n"); ! buffer.append("# AliasToIdentifier (Module, Realname, Alias)"); ! for (FQIdentifier identifier : module.getAliasToIdentifier()) { ! buffer.append("\n# " + identifier.getModule() + " " + identifier.getRealName() + " " + identifier.getAlias()); ! } ! this.setTestGenerated(buffer.toString().trim()); ! assertEquals(getExpected(), getGenerated()); ! } ! @Override ! public String getExpected() { ! return getResult(); ! } } |