mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Fix typo causing Date.new(year, month) to fail
Add a test for this case.
This commit is contained in:
parent
e8f90e7397
commit
5fe8943fda
Notes:
git
2019-10-25 04:35:21 +09:00
2 changed files with 5 additions and 1 deletions
|
@ -3438,7 +3438,7 @@ date_initialize(int argc, VALUE *argv, VALUE self)
|
|||
check_numeric(vd, "day");
|
||||
num2int_with_frac(d, positive_inf);
|
||||
case 2:
|
||||
check_numeric(vd, "month");
|
||||
check_numeric(vm, "month");
|
||||
m = NUM2INT(vm);
|
||||
case 1:
|
||||
check_numeric(vy, "year");
|
||||
|
|
|
@ -165,6 +165,10 @@ class TestDateNew < Test::Unit::TestCase
|
|||
assert_equal([2001, 2, 3, 4, 5, 6, 0],
|
||||
[d.year, d.mon, d.mday, d.hour, d.min, d.sec, d.offset])
|
||||
assert_equal(1.to_r/2, d.sec_fraction)
|
||||
|
||||
d = DateTime.civil(2001, 2)
|
||||
assert_equal([2001, 2, 1, 0, 0, 0, 0],
|
||||
[d.year, d.mon, d.mday, d.hour, d.min, d.sec, d.offset])
|
||||
end
|
||||
|
||||
def test_civil__neg
|
||||
|
|
Loading…
Reference in a new issue