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:
parent
a0fe396555
commit
1bf796c69d
1 changed files with 4 additions and 2 deletions
|
@ -277,16 +277,18 @@ class TestDateArith < Test::Unit::TestCase
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_step__compare
|
def test_step__compare
|
||||||
|
p = Date.new(2000, 1, 1)
|
||||||
|
q = Date.new(1999, 12, 31)
|
||||||
o = Object.new
|
o = Object.new
|
||||||
def o.<=>(*);end
|
def o.<=>(*);end
|
||||||
assert_raise(ArgumentError) {
|
assert_raise(ArgumentError) {
|
||||||
Date.new(2000, 1, 1).step(3, o).to_a
|
p.step(q, o).to_a
|
||||||
}
|
}
|
||||||
|
|
||||||
o = Object.new
|
o = Object.new
|
||||||
def o.<=>(*);2;end
|
def o.<=>(*);2;end
|
||||||
a = []
|
a = []
|
||||||
Date.new(2000, 1, 1).step(3, o) {|d| a << d}
|
p.step(q, o) {|d| a << d}
|
||||||
assert_empty(a)
|
assert_empty(a)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue