diff options
-rw-r--r-- | range.c | 5 | ||||
-rw-r--r-- | test/ruby/test_range.rb | 3 |
2 files changed, 7 insertions, 1 deletions
@@ -1266,7 +1266,10 @@ range_minmax(VALUE range) if (rb_block_given_p()) { return rb_call_super(0, NULL); } - return rb_assoc_new(range_min(0, NULL, range), range_max(0, NULL, range)); + return rb_assoc_new( + rb_funcall(range, rb_intern("min"), 0), + rb_funcall(range, rb_intern("max"), 0) + ); } int diff --git a/test/ruby/test_range.rb b/test/ruby/test_range.rb index b37dbbc433..3953b3ecc2 100644 --- a/test/ruby/test_range.rb +++ b/test/ruby/test_range.rb @@ -146,6 +146,9 @@ class TestRange < Test::Unit::TestCase assert_equal([nil, nil], (0...0).minmax) assert_equal([2, 1], (1..2).minmax{|a, b| b <=> a}) + + assert_equal(['a', 'c'], ('a'..'c').minmax) + assert_equal(['a', 'b'], ('a'...'c').minmax) end def test_initialize_twice |