1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Fix Date#step test

The document states that "the limit should be a date object".
This commit is contained in:
Nobuyoshi Nakada 2019-08-07 08:57:22 +09:00
parent a0fe396555
commit 1bf796c69d
No known key found for this signature in database
GPG key ID: 4BC7D6DF58D8DF60

View file

@ -277,16 +277,18 @@ class TestDateArith < Test::Unit::TestCase
end
def test_step__compare
p = Date.new(2000, 1, 1)
q = Date.new(1999, 12, 31)
o = Object.new
def o.<=>(*);end
assert_raise(ArgumentError) {
Date.new(2000, 1, 1).step(3, o).to_a
p.step(q, o).to_a
}
o = Object.new
def o.<=>(*);2;end
a = []
Date.new(2000, 1, 1).step(3, o) {|d| a << d}
p.step(q, o) {|d| a << d}
assert_empty(a)
end
end