|
From: <caw...@us...> - 2007-03-23 15:16:22
|
Revision: 2216
http://svn.sourceforge.net/rubyeclipse/?rev=2216&view=rev
Author: cawilliams
Date: 2007-03-23 08:16:20 -0700 (Fri, 23 Mar 2007)
Log Message:
-----------
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/core/builder/TC_RubyLintVisitor.java
Modified: trunk/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/core/builder/TC_RubyLintVisitor.java
===================================================================
--- trunk/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/core/builder/TC_RubyLintVisitor.java 2007-03-23 15:01:37 UTC (rev 2215)
+++ trunk/org.rubypeople.rdt.core.tests/src/org/rubypeople/rdt/internal/core/builder/TC_RubyLintVisitor.java 2007-03-23 15:16:20 UTC (rev 2216)
@@ -1,63 +1,38 @@
package org.rubypeople.rdt.internal.core.builder;
import java.io.StringReader;
-import java.util.ArrayList;
import java.util.List;
import junit.framework.TestCase;
import org.jruby.ast.Node;
-import org.jruby.ast.visitor.NodeVisitor;
import org.rubypeople.eclipse.shams.resources.ShamFile;
-import org.rubypeople.rdt.core.IProblemRequestor;
-import org.rubypeople.rdt.core.compiler.IProblem;
+import org.rubypeople.rdt.core.compiler.CategorizedProblem;
import org.rubypeople.rdt.internal.core.parser.RubyParser;
import org.rubypeople.rdt.internal.core.parser.warnings.DelegatingVisitor;
import org.rubypeople.rdt.internal.core.parser.warnings.RubyLintVisitor;
public class TC_RubyLintVisitor extends TestCase {
-
- class MockProblemRequestor implements IProblemRequestor {
- List problems;
-
- public MockProblemRequestor() {
- problems = new ArrayList();
- }
-
- public void acceptProblem(IProblem problem) {
- problems.add(problem);
- }
-
- public void beginReporting() {
- }
-
- public void endReporting() {
- }
-
- public boolean isActive() {
- return false;
- }
- }
- private MockProblemRequestor problemRequestor;
+ private List<CategorizedProblem> problems;
public void testUnlessModififerDoesntCreateEmptyConditionalWarning() throws Exception {
runLint("@var = 3 unless @blah");
- assertEquals(0, problemRequestor.problems.size());
+ assertEquals(0, problems.size());
}
public void testUnlessConditionalDoesntCreateEmptyConditionalWarning() throws Exception {
runLint("unless @blah\n @var = 3\nend");
- assertEquals(0, problemRequestor.problems.size());
+ assertEquals(0, problems.size());
}
private void runLint(String contents) {
RubyParser parser = new RubyParser();
Node rootNode = parser.parse(new ShamFile("fake/path.rb"), new StringReader(contents));
- problemRequestor = new MockProblemRequestor();
- List<RubyLintVisitor> visitors = DelegatingVisitor.createVisitors(contents, problemRequestor);
- NodeVisitor visitor = new DelegatingVisitor(visitors);
+ List<RubyLintVisitor> visitors = DelegatingVisitor.createVisitors(contents);
+ DelegatingVisitor visitor = new DelegatingVisitor(visitors);
rootNode.accept(visitor);
+ problems = visitor.getProblems();
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|