|
From: David C. <dc...@us...> - 2005-11-12 19:16:22
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/internal/ui/search In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25631/src/org/rubypeople/rdt/internal/ui/search Modified Files: TC_GroupByScopeStrategy.java TC_RubySearchTreeContentProvider.java Log Message: 1) refactored RubyBuilder again, this time with better unit tests. 2) refactored Location (and SymbolIndex) to be IFile based, rather than IPath based. 3) general improvement on maintainence of the SymbolIndex. Index: TC_RubySearchTreeContentProvider.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/internal/ui/search/TC_RubySearchTreeContentProvider.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TC_RubySearchTreeContentProvider.java 26 Oct 2005 21:55:03 -0000 1.2 --- TC_RubySearchTreeContentProvider.java 12 Nov 2005 19:16:11 -0000 1.3 *************** *** 13,18 **** ! import org.eclipse.core.runtime.Path; import org.eclipse.search.ui.text.Match; import org.rubypeople.rdt.internal.core.parser.RdtPosition; import org.rubypeople.rdt.internal.core.symbols.Location; --- 13,21 ---- ! import junit.framework.Assert; ! import junit.framework.TestCase; ! import org.eclipse.search.ui.text.Match; + import org.rubypeople.eclipse.shams.resources.ShamFile; import org.rubypeople.rdt.internal.core.parser.RdtPosition; import org.rubypeople.rdt.internal.core.symbols.Location; *************** *** 20,26 **** import org.rubypeople.rdt.internal.core.symbols.SearchResult; - import junit.framework.Assert; - import junit.framework.TestCase; - public class TC_RubySearchTreeContentProvider extends TestCase { --- 23,26 ---- *************** *** 35,39 **** } ! public void testGroupByPath() { // could be a MockSearchResult instead RubySearchResult rubyUISearchResult = new RubySearchResult(null); --- 35,39 ---- } ! public void testGroupByFIle() { // could be a MockSearchResult instead RubySearchResult rubyUISearchResult = new RubySearchResult(null); *************** *** 42,52 **** // initialize does not refresh the viewer, therefore elementsChanges is called here MethodSymbol methodSymbol = new MethodSymbol("myMethod") ; ! Path path = new Path("test") ; ! Location location = new Location(path,new RdtPosition(0,0,0,0)) ; SearchResult searchResult = new SearchResult(methodSymbol, location) ; rubyUISearchResult.addMatch(new Match(searchResult, Match.UNIT_CHARACTER, 0, 0)); rubySearchTreeContentProvider.elementsChanged(new Object[]{searchResult}) ; ! Assert.assertTrue(mockTreeViewer.isParentAdded(path)) ; } --- 42,52 ---- // initialize does not refresh the viewer, therefore elementsChanges is called here MethodSymbol methodSymbol = new MethodSymbol("myMethod") ; ! ShamFile file = new ShamFile("test") ; ! Location location = new Location(file,new RdtPosition(0,0,0,0)) ; SearchResult searchResult = new SearchResult(methodSymbol, location) ; rubyUISearchResult.addMatch(new Match(searchResult, Match.UNIT_CHARACTER, 0, 0)); rubySearchTreeContentProvider.elementsChanged(new Object[]{searchResult}) ; ! Assert.assertTrue(mockTreeViewer.isParentAdded(file)) ; } *************** *** 60,65 **** // initialize does not refresh the viewer, therefore elementsChanges is called here MethodSymbol methodSymbol = new MethodSymbol("myModule::myScope::myMethod") ; ! Path path = new Path("test") ; ! Location location = new Location(path,new RdtPosition(0,0,0,0)) ; SearchResult searchResult = new SearchResult(methodSymbol, location) ; rubyUISearchResult.addMatch(new Match(searchResult, Match.UNIT_CHARACTER, 0, 0)); --- 60,65 ---- // initialize does not refresh the viewer, therefore elementsChanges is called here MethodSymbol methodSymbol = new MethodSymbol("myModule::myScope::myMethod") ; ! ShamFile file = new ShamFile("test") ; ! Location location = new Location(file,new RdtPosition(0,0,0,0)) ; SearchResult searchResult = new SearchResult(methodSymbol, location) ; rubyUISearchResult.addMatch(new Match(searchResult, Match.UNIT_CHARACTER, 0, 0)); Index: TC_GroupByScopeStrategy.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.ui.tests/src/org/rubypeople/rdt/internal/ui/search/TC_GroupByScopeStrategy.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** TC_GroupByScopeStrategy.java 26 Oct 2005 21:55:03 -0000 1.1 --- TC_GroupByScopeStrategy.java 12 Nov 2005 19:16:11 -0000 1.2 *************** *** 1,5 **** package org.rubypeople.rdt.internal.ui.search; ! import org.eclipse.core.runtime.Path; import org.rubypeople.rdt.internal.core.parser.RdtPosition; import org.rubypeople.rdt.internal.core.symbols.Location; --- 1,8 ---- package org.rubypeople.rdt.internal.ui.search; ! import junit.framework.Assert; ! import junit.framework.TestCase; ! ! import org.rubypeople.eclipse.shams.resources.ShamFile; import org.rubypeople.rdt.internal.core.parser.RdtPosition; import org.rubypeople.rdt.internal.core.symbols.Location; *************** *** 7,13 **** import org.rubypeople.rdt.internal.core.symbols.SearchResult; - import junit.framework.Assert; - import junit.framework.TestCase; - public class TC_GroupByScopeStrategy extends TestCase { --- 10,13 ---- *************** *** 32,36 **** public void testSearchResult() { MethodSymbol methodSymbol = new MethodSymbol("clazz::myMethod") ; ! SearchResult searchResult = new SearchResult(methodSymbol, new Location(new Path("test"), new RdtPosition(0,0,0,0))) ; Assert.assertEquals(new Scope("clazz"), groupByScopeStrategy.getParent(searchResult)) ; } --- 32,36 ---- public void testSearchResult() { MethodSymbol methodSymbol = new MethodSymbol("clazz::myMethod") ; ! SearchResult searchResult = new SearchResult(methodSymbol, new Location(new ShamFile("test"), new RdtPosition(0,0,0,0))) ; Assert.assertEquals(new Scope("clazz"), groupByScopeStrategy.getParent(searchResult)) ; } |