summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2019-10-26 02:15:18 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2019-10-26 12:52:50 +0900
commitcf9344131c3d0f5993c6d999c427a4c656df30a2 (patch)
tree40de7e8be0e445e174498ae0a3555aa2ffea6260 /test
parentf14b754151c8b6a006871cff8f590b9b608a7697 (diff)
Raise on end-exclusive ranges [Feature #14784]
Raises an error on end-exclusive ranges unless endless, regardless the receiver.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/2613
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_comparable.rb12
1 files changed, 6 insertions, 6 deletions
diff --git a/test/ruby/test_comparable.rb b/test/ruby/test_comparable.rb
index e8a2ff1a7a..b849217b7d 100644
--- a/test/ruby/test_comparable.rb
+++ b/test/ruby/test_comparable.rb
@@ -99,22 +99,22 @@ class TestComparable < Test::Unit::TestCase
assert_equal(1, @o.clamp(1..1))
assert_equal(@o, @o.clamp(0..0))
- assert_equal(1, @o.clamp(1...2))
assert_equal(1, @o.clamp(1..))
assert_equal(1, @o.clamp(1...))
- assert_equal(@o, @o.clamp(0...2))
assert_equal(@o, @o.clamp(0..))
assert_equal(@o, @o.clamp(0...))
assert_equal(@o, @o.clamp(..2))
- assert_equal(@o, @o.clamp(...2))
assert_equal(-1, @o.clamp(-2..-1))
assert_equal(@o, @o.clamp(-2..0))
assert_equal(@o, @o.clamp(-2..))
assert_equal(@o, @o.clamp(-2...))
- assert_raise_with_message(ArgumentError, 'cannot clamp with an exclusive range') {
- @o.clamp(-1...0)
- }
+ exc = [ArgumentError, 'cannot clamp with an exclusive range']
+ assert_raise_with_message(*exc) {@o.clamp(1...2)}
+ assert_raise_with_message(*exc) {@o.clamp(0...2)}
+ assert_raise_with_message(*exc) {@o.clamp(-1...0)}
+ assert_raise_with_message(*exc) {@o.clamp(...2)}
+
assert_raise_with_message(ArgumentError, 'min argument must be smaller than max argument') {
@o.clamp(2..1)
}