diff options
| author | Jérôme Parent-Lévesque <jerome.parent-levesque@potloc.com> | 2025-03-15 15:05:50 -0400 |
|---|---|---|
| committer | Nobuyoshi Nakada <nobu.nakada@gmail.com> | 2025-03-17 16:26:23 +0900 |
| commit | b5cdbadeeddd2b8e834b9d5565c13fcc43f3e684 (patch) | |
| tree | 6075326c8bfd5d2c5026f3ffd1022ee636742418 /test/ruby | |
| parent | 3e04f7b69fb56eac88b56f491b6a298fcc28b7f9 (diff) | |
[Bug #21185] Fix Range#overlap? with infinite range
Infinite ranges, i.e. unbounded ranges, should overlap with any other range
which wasn't the case in the following example: (0..3).overlap?(nil..nil)
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/12937
Diffstat (limited to 'test/ruby')
| -rw-r--r-- | test/ruby/test_range.rb | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/test/ruby/test_range.rb b/test/ruby/test_range.rb index bc73de78d3..f875c0ab40 100644 --- a/test/ruby/test_range.rb +++ b/test/ruby/test_range.rb @@ -1513,6 +1513,7 @@ class TestRange < Test::Unit::TestCase assert_operator((nil..nil), :overlap?, (3..)) assert_operator((nil...nil), :overlap?, (nil..)) assert_operator((nil..nil), :overlap?, (..3)) + assert_operator((..3), :overlap?, (nil..nil)) assert_raise(TypeError) { (1..3).overlap?(1) } |
