|
From: Markus B. <mba...@us...> - 2005-10-23 22:24:27
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/core/builder In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3449/src/org/rubypeople/rdt/internal/core/builder Modified Files: ShamSymbolIndex.java TC_IndexUpdater.java Log Message: added indexing of method definitions Index: TC_IndexUpdater.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/core/builder/TC_IndexUpdater.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** TC_IndexUpdater.java 23 Oct 2005 19:34:03 -0000 1.4 --- TC_IndexUpdater.java 23 Oct 2005 22:24:19 -0000 1.5 *************** *** 24,27 **** --- 24,28 ---- import org.rubypeople.rdt.internal.core.parser.RubyParser; import org.rubypeople.rdt.internal.core.symbols.ClassSymbol; + import org.rubypeople.rdt.internal.core.symbols.MethodSymbol; public class TC_IndexUpdater extends TestCase { *************** *** 101,105 **** --- 102,123 ---- symbolIndex.assertAdded(new ClassSymbol("Foo::Bar::InnerBar"), file, new RdtPosition(2, 3, 35, 36)); } + + public void testMethod() throws Exception { + Node node = parseCode("def method\nend") ; + + updater.update(file,node); + + symbolIndex.assertAdded(new MethodSymbol("method"), file, new RdtPosition(0, 1, 3, 12)); + } + public void testMethodWithNesting() throws Exception { + Node node = parseCode("class Foo\ndef method\nend\nend") ; + + updater.update(file,node); + + symbolIndex.assertAdded(new MethodSymbol("Foo::method"), file, new RdtPosition(1, 2, 13, 24)); + } + + private Node parseCode(String code) throws CoreException { file.setContents(code); Index: ShamSymbolIndex.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/core/builder/ShamSymbolIndex.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ShamSymbolIndex.java 19 Oct 2005 00:33:05 -0000 1.1 --- ShamSymbolIndex.java 23 Oct 2005 22:24:19 -0000 1.2 *************** *** 15,19 **** import org.eclipse.core.runtime.IPath; import org.jruby.lexer.yacc.ISourcePosition; ! import org.rubypeople.rdt.internal.core.symbols.ClassSymbol; import org.rubypeople.rdt.internal.core.symbols.SymbolIndex; --- 15,19 ---- import org.eclipse.core.runtime.IPath; import org.jruby.lexer.yacc.ISourcePosition; ! import org.rubypeople.rdt.internal.core.symbols.Symbol; import org.rubypeople.rdt.internal.core.symbols.SymbolIndex; *************** *** 21,25 **** private IFile fileArg; ! private ClassSymbol symbolArg; private ISourcePosition positionArg; private IPath flushedPathArg; --- 21,25 ---- private IFile fileArg; ! private Symbol symbolArg; private ISourcePosition positionArg; private IPath flushedPathArg; *************** *** 36,40 **** } ! public void assertAdded(ClassSymbol expectedSymbol, IFile expectedFile, ISourcePosition expectedPosition) { TC_IndexUpdater.assertEquals("Symbol", expectedSymbol, symbolArg); TC_IndexUpdater.assertEquals("File", expectedFile, fileArg); --- 36,40 ---- } ! public void assertAdded(Symbol expectedSymbol, IFile expectedFile, ISourcePosition expectedPosition) { TC_IndexUpdater.assertEquals("Symbol", expectedSymbol, symbolArg); TC_IndexUpdater.assertEquals("File", expectedFile, fileArg); *************** *** 42,46 **** } ! public void add(ClassSymbol symbol, IFile file, ISourcePosition position) { symbolArg = symbol; fileArg = file; --- 42,46 ---- } ! public void add(Symbol symbol, IFile file, ISourcePosition position) { symbolArg = symbol; fileArg = file; |