summaryrefslogtreecommitdiff
path: root/test/ruby/test_range.rb
diff options
context:
space:
mode:
authorJeremy Evans <code@jeremyevans.net>2022-02-09 09:58:05 -0800
committerJeremy Evans <code@jeremyevans.net>2022-02-09 19:47:28 -0800
commitfd710d7e9995679db80b7adf35bbda2cd4db90c6 (patch)
treeb4562df20ddfb4d1a1db40e960f0cebc747f36c4 /test/ruby/test_range.rb
parent05b1944c53205ffd8c11f1ec2ae6fd48485b55b1 (diff)
Fix Range#include? for beginless exclusive string ranges
Previously, include? would return true for the end of the range, when it should return false because the range is exclusive. Research and Analysis by Victor Shepelev. Fixes [Bug #18577]
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/5541
Diffstat (limited to 'test/ruby/test_range.rb')
-rw-r--r--test/ruby/test_range.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/test/ruby/test_range.rb b/test/ruby/test_range.rb
index 8ac1930be6..8789eca749 100644
--- a/test/ruby/test_range.rb
+++ b/test/ruby/test_range.rb
@@ -604,6 +604,10 @@ class TestRange < Test::Unit::TestCase
assert_include(0...10, 5)
assert_include(5..., 10)
assert_not_include(5..., 0)
+ assert_include(.."z", "z")
+ assert_not_include(..."z", "z")
+ assert_include(..10, 10)
+ assert_not_include(...10, 10)
end
def test_cover