|
From: <caw...@us...> - 2007-06-19 14:49:24
|
Revision: 2631
http://svn.sourceforge.net/rubyeclipse/?rev=2631&view=rev
Author: cawilliams
Date: 2007-06-19 07:49:21 -0700 (Tue, 19 Jun 2007)
Log Message:
-----------
add test for Trac #4903, which makes sure it is fixed. Also don't even try to catch RuntimeExceptiosn in the GemParser - let them bubble up, or we'll eat up CPU and keep failing forever.
Modified Paths:
--------------
trunk/com.aptana.rdt/src/com/aptana/rdt/internal/core/gems/GemParser.java
trunk/com.aptana.rdt.tests/src/com/aptana/rdt/internal/core/gems/GemParserTest.java
Added Paths:
-----------
trunk/com.aptana.rdt.tests/src/com/aptana/rdt/internal/core/gems/2line_description_end.txt
Modified: trunk/com.aptana.rdt/src/com/aptana/rdt/internal/core/gems/GemParser.java
===================================================================
--- trunk/com.aptana.rdt/src/com/aptana/rdt/internal/core/gems/GemParser.java 2007-06-19 14:27:41 UTC (rev 2630)
+++ trunk/com.aptana.rdt/src/com/aptana/rdt/internal/core/gems/GemParser.java 2007-06-19 14:49:21 UTC (rev 2631)
@@ -23,35 +23,33 @@
}
return parseOutGems(lines);
}
-
+
public Set<Gem> parseOutGems(List<String> lines) {
Set<Gem> gems = new HashSet<Gem>();
for (int i = 0; i < lines.size();) {
- try {
- String nameAndVersion = lines.get(i);
- String description = "";
- if ((i + 1) < lines.size()) {
- description = lines.get(i + 1);
- }
- int j = 2;
- while (true) {
- if ((i + j) >= lines.size()) break; // if there is no next line, break out
- String nextLine = lines.get(i + j);
- if (nextLine.trim().length() == 0) break; // if line is empty, break out
- description += " " + nextLine.trim(); // add line to description
- j++; // move to next line
- }
- int openParen = nameAndVersion.indexOf('(');
- int closeParen = nameAndVersion.indexOf(')');
- String name = nameAndVersion.substring(0, openParen);
- String version = nameAndVersion
- .substring(openParen + 1, closeParen);
- gems.add(new Gem(name.trim(), version, description.trim()));
- i += (j + 1);
- } catch (RuntimeException e) {
- AptanaRDTPlugin.log(new IllegalStateException("Was unable to parse local gems correctly from: " + lines.toString()));
- AptanaRDTPlugin.log(e);
+ String nameAndVersion = lines.get(i);
+ String description = "";
+ if ((i + 1) < lines.size()) {
+ description = lines.get(i + 1);
}
+ int j = 2;
+ while (true) {
+ if ((i + j) >= lines.size())
+ break; // if there is no next line, break out
+ String nextLine = lines.get(i + j);
+ if (nextLine.trim().length() == 0)
+ break; // if line is empty, break out
+ description += " " + nextLine.trim(); // add line to
+ // description
+ j++; // move to next line
+ }
+ int openParen = nameAndVersion.indexOf('(');
+ int closeParen = nameAndVersion.indexOf(')');
+ String name = nameAndVersion.substring(0, openParen);
+ String version = nameAndVersion
+ .substring(openParen + 1, closeParen);
+ gems.add(new Gem(name.trim(), version, description.trim()));
+ i += (j + 1);
}
return gems;
}
Added: trunk/com.aptana.rdt.tests/src/com/aptana/rdt/internal/core/gems/2line_description_end.txt
===================================================================
--- trunk/com.aptana.rdt.tests/src/com/aptana/rdt/internal/core/gems/2line_description_end.txt (rev 0)
+++ trunk/com.aptana.rdt.tests/src/com/aptana/rdt/internal/core/gems/2line_description_end.txt 2007-06-19 14:49:21 UTC (rev 2631)
@@ -0,0 +1,70 @@
+
+*** LOCAL GEMS ***
+
+actionmailer (1.3.3, 1.3.2, 1.3.1, 1.3.0, 1.2.5, 1.2.4)
+ Service layer for easy email delivery and testing.
+
+actionpack (1.13.3, 1.13.2, 1.13.1, 1.13.0, 1.12.5, 1.12.4)
+ Web-flow and rendering framework putting the VC in MVC.
+
+actionwebservice (1.2.3, 1.2.2, 1.2.1, 1.2.0, 1.1.6, 1.1.5, 1.1.4, 1.1.3, 1.1.2, 1.1.1, 1.1.0, 0.9.4)
+ Web service support for Action Pack.
+
+activerecord (1.15.3, 1.15.2, 1.15.1, 1.15.0, 1.14.4)
+ Implements the ActiveRecord pattern for ORM.
+
+activesupport (1.4.2, 1.4.1, 1.4.0, 1.3.1)
+ Support and utility classes used by the Rails framework.
+
+cgi_multipart_eof_fix (2.1)
+ Fix an exploitable bug in CGI multipart parsing which affects Ruby
+ <= 1.8.5 when multipart boundary attribute contains a non-halting
+ regular expression string.
+
+fastercsv (1.2.0)
+ FasterCSV is CSV, but faster, smaller, and cleaner.
+
+fxri (0.3.6)
+ Graphical interface to the RI documentation, with search engine.
+
+fxruby (1.6.11, 1.6.6)
+ FXRuby is the Ruby binding to the FOX GUI toolkit.
+
+gem_plugin (0.2.2)
+ A plugin system based only on rubygems that uses dependencies only
+
+hpricot (0.6, 0.4)
+ a swift, liberal HTML parser with a fantastic library
+
+log4r (1.0.5)
+ Log4r is a comprehensive and flexible logging library for Ruby.
+
+mongrel (1.0.1)
+ A small fast HTTP library and server that runs Rails, Camping, Nitro
+ and Iowa apps.
+
+rails (1.2.3, 1.2.2, 1.2.1, 1.2.0, 1.1.6, 1.1.5)
+ Web-application framework with template engine, control-flow layer,
+ and ORM.
+
+rake (0.7.3, 0.7.2)
+ Ruby based make-like utility.
+
+rspec (1.0.5, 0.9.4)
+ RSpec-1.0.5 (r2081) - BDD for Ruby http://rspec.rubyforge.org/
+
+ruby-debug (0.9.3, 0.9.2)
+ Command line interface (CLI) for ruby-debug-base
+
+ruby-debug-base (0.9.3, 0.9.2)
+ Fast Ruby debugger
+
+ruby-debug-ide (0.1.6, 0.1.4, 0.1.2)
+ IDE interface for ruby-debug.
+
+sources (0.0.1)
+ This package provides download sources for remote gem installation
+
+sqlite3-ruby (1.2.1)
+ SQLite3/Ruby is a module to allow Ruby scripts to interface with a
+ SQLite database.
\ No newline at end of file
Modified: trunk/com.aptana.rdt.tests/src/com/aptana/rdt/internal/core/gems/GemParserTest.java
===================================================================
--- trunk/com.aptana.rdt.tests/src/com/aptana/rdt/internal/core/gems/GemParserTest.java 2007-06-19 14:27:41 UTC (rev 2630)
+++ trunk/com.aptana.rdt.tests/src/com/aptana/rdt/internal/core/gems/GemParserTest.java 2007-06-19 14:49:21 UTC (rev 2631)
@@ -22,6 +22,13 @@
Set<Gem> gems = parser.parse(contents);
assertEquals(31, gems.size());
}
+
+ public void testEndsWithTwoLineDescription() {
+ GemParser parser = new GemParser();
+ String contents = getContents("src/com/aptana/rdt/internal/core/gems/2line_description_end.txt");
+ Set<Gem> gems = parser.parse(contents);
+ assertEquals(21, gems.size());
+ }
private String getContents(String path) {
File file = AptanaRDTTests.getFileInPlugin(new Path(path));
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|