diff options
author | Kenta Murata <[email protected]> | 2020-10-23 15:26:51 +0900 |
---|---|---|
committer | GitHub <[email protected]> | 2020-10-23 15:26:51 +0900 |
commit | f754b422855131111092c0c147d744775cc4793f (patch) | |
tree | 1ca57f3b6cedb36549c456a79a57cffce940e6fc /spec/ruby/core/numeric/shared | |
parent | 40bad72f31248c48048249b1d7536e87b4994664 (diff) |
numeric.c, range.c: prohibit zero step
* numeric.c: prohibit zero step in Numeric#step
* range.c: prohibit zero step in Range#step
* Fix ruby-spec
[Feature #15573]
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/3689
Merged-By: mrkn <[email protected]>
Diffstat (limited to 'spec/ruby/core/numeric/shared')
-rw-r--r-- | spec/ruby/core/numeric/shared/step.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/spec/ruby/core/numeric/shared/step.rb b/spec/ruby/core/numeric/shared/step.rb index fac79b3e63..6c47cdeecb 100644 --- a/spec/ruby/core/numeric/shared/step.rb +++ b/spec/ruby/core/numeric/shared/step.rb @@ -261,8 +261,10 @@ describe :numeric_step, :shared => true do step_enum_class = Enumerator::ArithmeticSequence end - it "returns an #{step_enum_class} when step is 0" do - @step.call(1, 2, 0).should be_an_instance_of(step_enum_class) + ruby_version_is ""..."3.0" do + it "returns an #{step_enum_class} when step is 0" do + @step.call(1, 2, 0).should be_an_instance_of(step_enum_class) + end end it "returns an #{step_enum_class} when not passed a block and self > stop" do |