Skip to content

Commit

Permalink
Fix for JRUBY-4161: Potential Regression: Extlib spec suite: Enumerab…
Browse files Browse the repository at this point in the history
…le#entries wrong # of arguments(0 for 1)
  • Loading branch information
headius committed Oct 26, 2009
1 parent a2907cc commit c94588c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/org/jruby/RubyEnumerable.java
Expand Up @@ -345,8 +345,8 @@ public static IRubyObject to_a19(ThreadContext context, IRubyObject self) {
return result;
}

@JRubyMethod(name = {"to_a", "entries"}, required = 1, rest = true)
public static IRubyObject to_a19(ThreadContext context, IRubyObject self, IRubyObject[]args) {
@JRubyMethod(name = {"to_a", "entries"}, rest = true)
public static IRubyObject to_a19(ThreadContext context, IRubyObject self, IRubyObject[] args) {
Ruby runtime = context.getRuntime();
RubyArray result = runtime.newArray();
RuntimeHelpers.invoke(context, self, "each", args, CallBlock.newCallClosure(self, runtime.getEnumerable(),
Expand Down
1 change: 1 addition & 0 deletions test/jruby_index
Expand Up @@ -23,6 +23,7 @@ test_command_line_switches
test_comparable
test_core_arities
test_crazy_blocks
test_custom_enumerable
test_cvars_in_odd_scopes
test_date_time
test_defined
Expand Down
14 changes: 14 additions & 0 deletions test/test_custom_enumerable.rb
@@ -0,0 +1,14 @@
require 'test/unit'

class TestCustomEnumerable < Test::Unit::TestCase
class CustomEnumerable
include Enumerable
def each; yield 1; yield 2; yield 3; end
end

# JRUBY-4161
def test_entries
assert_equal [1,2,3], CustomEnumerable.new.entries
assert_equal [1,2,3], CustomEnumerable.new.entries(*[])
end
end

0 comments on commit c94588c

Please sign in to comment.