|
From: David C. <dc...@us...> - 2005-10-19 00:33:15
|
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-serv24760/src/org/rubypeople/rdt/internal/core/builder Modified Files: TC_IndexUpdater.java Added Files: ShamSymbolIndex.java Log Message: Update SymbolIndex when a new project is opened. 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.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TC_IndexUpdater.java 16 Oct 2005 17:29:16 -0000 1.2 --- TC_IndexUpdater.java 19 Oct 2005 00:33:05 -0000 1.3 *************** *** 15,31 **** import junit.framework.TestCase; - import org.eclipse.core.resources.IFile; import org.eclipse.core.runtime.CoreException; - import org.eclipse.core.runtime.IPath; import org.jruby.ast.ClassNode; import org.jruby.ast.Colon2Node; import org.jruby.ast.Node; import org.jruby.ast.TrueNode; - import org.jruby.lexer.yacc.ISourcePosition; import org.rubypeople.eclipse.shams.resources.ShamFile; import org.rubypeople.rdt.internal.core.parser.RdtPosition; import org.rubypeople.rdt.internal.core.parser.RubyParser; import org.rubypeople.rdt.internal.core.symbols.ClassSymbol; - import org.rubypeople.rdt.internal.core.symbols.SymbolIndex; public class TC_IndexUpdater extends TestCase { --- 15,27 ---- *************** *** 36,44 **** private IndexUpdater updater; private ShamFile file; ! private MockSymbolIndex symbolIndex; public void setUp() { file = new ShamFile("TestFile.rb"); ! symbolIndex = new MockSymbolIndex(); updater = new IndexUpdater(symbolIndex); } --- 32,40 ---- private IndexUpdater updater; private ShamFile file; ! private ShamSymbolIndex symbolIndex; public void setUp() { file = new ShamFile("TestFile.rb"); ! symbolIndex = new ShamSymbolIndex(); updater = new IndexUpdater(symbolIndex); } *************** *** 103,137 **** return new RubyParser().parse(file, reader); } - - private static class MockSymbolIndex extends SymbolIndex { - - private IFile fileArg; - private ClassSymbol symbolArg; - private ISourcePosition positionArg; - private IPath flushedPathArg; - - public void flush(IPath path) { - flushedPathArg = path; - } - public void assertFlushed(IPath expectedPath) { - assertEquals("Flushed path", expectedPath, flushedPathArg); - } - - public void assertAddNotCalled() { - assertNull("Unexpected call to assertAddNotCalled()", fileArg); - } - - public void assertAdded(ClassSymbol expectedSymbol, IFile expectedFile, ISourcePosition expectedPosition) { - assertEquals("Symbol", expectedSymbol, symbolArg); - assertEquals("File", expectedFile, fileArg); - assertEquals("Position", expectedPosition, positionArg); - - } - public void add(ClassSymbol symbol, IFile file, ISourcePosition position) { - symbolArg = symbol; - fileArg = file; - positionArg = position; - } - - } } \ No newline at end of file --- 99,101 ---- --- NEW FILE: ShamSymbolIndex.java --- /* * Author: David Corbin * * Copyright (c) 2005 RubyPeople. * * This file is part of the Ruby Development Tools (RDT) plugin for eclipse. * RDT is subject to the "Common Public License (CPL) v 1.0". You may not use * RDT except in compliance with the License. For further information see * org.rubypeople.rdt/rdt.license. */ package org.rubypeople.rdt.internal.core.builder; import org.eclipse.core.resources.IFile; 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; public class ShamSymbolIndex extends SymbolIndex { private IFile fileArg; private ClassSymbol symbolArg; private ISourcePosition positionArg; private IPath flushedPathArg; public void flush(IPath path) { flushedPathArg = path; } public void assertFlushed(IPath expectedPath) { TC_IndexUpdater.assertEquals("Flushed path", expectedPath, flushedPathArg); } public void assertAddNotCalled() { TC_IndexUpdater.assertNull("Unexpected call to assertAddNotCalled()", fileArg); } public void assertAdded(ClassSymbol expectedSymbol, IFile expectedFile, ISourcePosition expectedPosition) { TC_IndexUpdater.assertEquals("Symbol", expectedSymbol, symbolArg); TC_IndexUpdater.assertEquals("File", expectedFile, fileArg); TC_IndexUpdater.assertEquals("Position", expectedPosition, positionArg); } public void add(ClassSymbol symbol, IFile file, ISourcePosition position) { symbolArg = symbol; fileArg = file; positionArg = position; } } |