diff options
author | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-01-23 11:16:09 +0000 |
---|---|---|
committer | shugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-01-23 11:16:09 +0000 |
commit | 62b750bb55916e526fb53cb4c19da777872c27f6 (patch) | |
tree | 7e49160cfe595f152b552f7420a8f31d3ed4161b /test/ruby/test_range.rb | |
parent | 387e838c024cbe59c5df297d8ad36012406e38d1 (diff) | |
download | ruby-62b750bb55916e526fb53cb4c19da777872c27f6.tar.gz |
* range.c (range_eqq): revert r11113 because rb_call_super() is
called in range_include() and thus r11113 doesn't work when the
receiver Range object consists of non linear objects such as Date
objects.
[ruby-core:72908] [Bug #12003]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53635 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_range.rb')
-rw-r--r-- | test/ruby/test_range.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/ruby/test_range.rb b/test/ruby/test_range.rb index 046f69e9de..2fc2a2b1d3 100644 --- a/test/ruby/test_range.rb +++ b/test/ruby/test_range.rb @@ -314,6 +314,30 @@ class TestRange < Test::Unit::TestCase } end + def test_eqq_non_linear + bug12003 = '[ruby-core:72908] [Bug #12003]' + c = Class.new { + attr_reader :value + + def initialize(value) + @value = value + end + + def succ + self.class.new(@value.succ) + end + + def ==(other) + @value == other.value + end + + def <=>(other) + @value <=> other.value + end + } + assert_operator(c.new(0)..c.new(10), :===, c.new(5), bug12003) + end + def test_include assert_include("a".."z", "c") assert_not_include("a".."z", "5") |