Skip to content

Commit

Permalink
[Truffle] Add cgi to stdlib.
Browse files Browse the repository at this point in the history
  • Loading branch information
bjfish committed Apr 27, 2015
1 parent 776534d commit 8bb41db
Show file tree
Hide file tree
Showing 18 changed files with 39 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/ruby/truffle/mri/cgi.rb
@@ -0,0 +1 @@
require_relative '../../stdlib/cgi'
1 change: 1 addition & 0 deletions lib/ruby/truffle/mri/cgi/cookie.rb
@@ -0,0 +1 @@
require_relative '../../../stdlib/cgi/cookie'
1 change: 1 addition & 0 deletions lib/ruby/truffle/mri/cgi/core.rb
@@ -0,0 +1 @@
require_relative '../../../stdlib/cgi/core'
1 change: 1 addition & 0 deletions lib/ruby/truffle/mri/cgi/html.rb
@@ -0,0 +1 @@
require_relative '../../../stdlib/cgi/html'
1 change: 1 addition & 0 deletions lib/ruby/truffle/mri/cgi/session.rb
@@ -0,0 +1 @@
require_relative '../../../stdlib/cgi/session'
1 change: 1 addition & 0 deletions lib/ruby/truffle/mri/cgi/session/pstore.rb
@@ -0,0 +1 @@
require_relative '../../../../stdlib/cgi/session/pstore'
1 change: 1 addition & 0 deletions spec/truffle/tags/library/cgi/cookie/path_tags.txt
@@ -0,0 +1 @@
fails:CGI::Cookie#path returns self's path
2 changes: 2 additions & 0 deletions spec/truffle/tags/library/cgi/cookie/to_s_tags.txt
@@ -0,0 +1,2 @@
fails:CGI::Cookie#to_s returns a String representation of self
fails:CGI::Cookie#to_s escapes the self's values
1 change: 1 addition & 0 deletions spec/truffle/tags/library/cgi/escape_tags.txt
@@ -0,0 +1 @@
fails:CGI.escape url-encodes the passed argument
5 changes: 5 additions & 0 deletions spec/truffle/tags/library/cgi/htmlextension/a_tags.txt
@@ -0,0 +1,5 @@
fails:CGI::HtmlExtension#a when passed a String includes the passed block's return value when passed a block
fails:CGI::HtmlExtension#a when passed a Hash includes the passed block's return value when passed a block
fails:CGI::HtmlExtension#a when each HTML generation returns the doctype declaration for HTML3
fails:CGI::HtmlExtension#a when each HTML generation returns the doctype declaration for HTML4
fails:CGI::HtmlExtension#a when each HTML generation returns the doctype declaration for the Transitional version of HTML4
@@ -0,0 +1,2 @@
fails:CGI::HtmlExtension#blockquote when passed a String includes the passed block's return value when passed a block
fails:CGI::HtmlExtension#blockquote when passed a Hash includes the passed block's return value when passed a block
2 changes: 2 additions & 0 deletions spec/truffle/tags/library/cgi/htmlextension/caption_tags.txt
@@ -0,0 +1,2 @@
fails:CGI::HtmlExtension#caption when passed a String includes the passed block's return value when passed a block
fails:CGI::HtmlExtension#caption when passed a Hash includes the passed block's return value when passed a block
5 changes: 5 additions & 0 deletions spec/truffle/tags/library/cgi/htmlextension/html_tags.txt
@@ -0,0 +1,5 @@
fails:CGI::HtmlExtension#html when passed no arguments includes the passed block when passed a block
fails:CGI::HtmlExtension#html when passed 'PRETTY' includes the passed block when passed a block
fails:CGI::HtmlExtension#html when each HTML generation returns the doctype declaration for HTML3
fails:CGI::HtmlExtension#html when each HTML generation returns the doctype declaration for HTML4
fails:CGI::HtmlExtension#html when each HTML generation returns the doctype declaration for the Transitional version of HTML4
5 changes: 5 additions & 0 deletions spec/truffle/tags/library/cgi/htmlextension/textarea_tags.txt
@@ -0,0 +1,5 @@
fails:CGI::HtmlExtension#textarea when passed no arguments includes the return value of the passed block when passed a block
fails:CGI::HtmlExtension#textarea when passed name includes the return value of the passed block when passed a block
fails:CGI::HtmlExtension#textarea when passed name, cols includes the return value of the passed block when passed a block
fails:CGI::HtmlExtension#textarea when passed name, cols, rows includes the return value of the passed block when passed a block
fails:CGI::HtmlExtension#textarea when passed Hash includes the return value of the passed block when passed a block
1 change: 1 addition & 0 deletions spec/truffle/tags/library/cgi/http_header_tags.txt
@@ -0,0 +1 @@
fails:CGI#http_header CGI#http_header when passed Hash returns a HTTP header based on the Hash's key/value pairs
1 change: 1 addition & 0 deletions spec/truffle/tags/library/cgi/rfc1123_date_tags.txt
@@ -0,0 +1 @@
fails:CGI.rfc1123_date when passsed Time returns the passed Time formatted in RFC1123 ('Sat, 01 Dec 2007 15:56:42 GMT')
1 change: 1 addition & 0 deletions spec/truffle/truffle.mspec
Expand Up @@ -86,6 +86,7 @@ class MSpecScript
"spec/ruby/library/date",
"spec/ruby/library/datetime",
"spec/ruby/library/delegate",
"spec/ruby/library/cgi",
"spec/ruby/library/erb",
"spec/ruby/library/getoptlong",
"spec/ruby/library/matrix",
Expand Down
Expand Up @@ -11,6 +11,8 @@

import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.source.SourceSection;
import org.jcodings.specific.ASCIIEncoding;
import org.jcodings.specific.USASCIIEncoding;
import org.jruby.truffle.nodes.RubyNode;
import org.jruby.truffle.nodes.dispatch.CallDispatchHeadNode;
import org.jruby.truffle.nodes.dispatch.DispatchHeadNode;
Expand Down Expand Up @@ -46,6 +48,11 @@ public RubyRegexp executeRubyRegexp(VirtualFrame frame) {
strings[n] = org.jruby.RubyString.newString(getContext().getRuntime(), ((RubyString) toS.call(frame, child, "to_s", null)).getBytes());
}

// TODO 27-APR=2015 BJF Adding workaround to temporarily fix CGI error until Regex overhaul https://github.com/jruby/jruby/issues/2802
if (!options.isEncodingNone() && strings.length > 0 && strings[0].getEncoding() == ASCIIEncoding.INSTANCE && strings[0].getByteList().getRealSize() == 0) {
strings[0].setEncoding(USASCIIEncoding.INSTANCE);
}

This comment has been minimized.

Copy link
@bjfish

bjfish Apr 27, 2015

Author Contributor

@nirvdrum @chrisseaton I added this workaround as a temporary fix for issue: #2802

This comment has been minimized.

Copy link
@chrisseaton

chrisseaton Apr 27, 2015

Contributor

Yeah that's fine - we have one or two other special cases like this. As long as they're well documented like this one.


final org.jruby.RubyString preprocessed = org.jruby.RubyRegexp.preprocessDRegexp(getContext().getRuntime(), strings, options);

final RubyRegexp regexp = new RubyRegexp(this, getContext().getCoreLibrary().getRegexpClass(), preprocessed.getByteList(), options);
Expand Down

0 comments on commit 8bb41db

Please sign in to comment.