From 728b75bc9bba6786d36dbc19f3c05f26322d0946 Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 24 Jul 2018 07:47:01 +0000 Subject: time.rb: yday support * lib/time.rb (Time.make_time): added yday support. [ruby-core:87545] [Bug #14860] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64028 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/test_time.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'test') diff --git a/test/test_time.rb b/test/test_time.rb index 26a7daaf2a..29fad6fbf4 100644 --- a/test/test_time.rb +++ b/test/test_time.rb @@ -495,6 +495,16 @@ class TestTimeExtension < Test::Unit::TestCase # :nodoc: assert_equal(true, t.utc?) end + def test_strptime_j + t = Time.strptime("2018-365", "%Y-%j") + assert_equal(2018, t.year) + assert_equal(12, t.mon) + assert_equal(31, t.day) + assert_equal(0, t.hour) + assert_equal(0, t.min) + assert_equal(0, t.sec) + end + def test_nsec assert_equal(123456789, Time.parse("2000-01-01T00:00:00.123456789+00:00").tv_nsec) end -- cgit v1.2.3