ruby-changes:58425
From: Jeremy <ko1@a...>
Date: Fri, 25 Oct 2019 04:35:09 +0900 (JST)
Subject: [ruby-changes:58425] 5fe8943fda (master): Fix typo causing Date.new(year, month) to fail
https://git.ruby-lang.org/ruby.git/commit/?id=5fe8943fda From 5fe8943fdaf765dc01d986abafe85bd3eafb7814 Mon Sep 17 00:00:00 2001 From: Jeremy Evans <code@j...> Date: Thu, 24 Oct 2019 09:35:02 -0700 Subject: Fix typo causing Date.new(year, month) to fail Add a test for this case. diff --git a/ext/date/date_core.c b/ext/date/date_core.c index decaec2..6301fe6 100644 --- a/ext/date/date_core.c +++ b/ext/date/date_core.c @@ -3438,7 +3438,7 @@ date_initialize(int argc, VALUE *argv, VALUE self) https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L3438 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"); diff --git a/test/date/test_date_new.rb b/test/date/test_date_new.rb index 2fb9846..b90eadf 100644 --- a/test/date/test_date_new.rb +++ b/test/date/test_date_new.rb @@ -165,6 +165,10 @@ class TestDateNew < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/date/test_date_new.rb#L165 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 -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/