ruby-changes:54537
From: nobu <ko1@a...>
Date: Tue, 8 Jan 2019 16:45:09 +0900 (JST)
Subject: [ruby-changes:54537] nobu:r66752 (trunk): Test for "%p" in Time.strptime
nobu 2019-01-08 16:45:04 +0900 (Tue, 08 Jan 2019) New Revision: 66752 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=66752 Log: Test for "%p" in Time.strptime Modified files: trunk/test/test_time.rb Index: test/test_time.rb =================================================================== --- test/test_time.rb (revision 66751) +++ test/test_time.rb (revision 66752) @@ -509,6 +509,25 @@ class TestTimeExtension < Test::Unit::Te https://github.com/ruby/ruby/blob/trunk/test/test_time.rb#L509 assert_equal(1, t.day) end + def test_strptime_p + t = Time.strptime("3am", "%I%p") + assert_equal(3, t.hour) + t = Time.strptime("3pm", "%I%p") + assert_equal(15, t.hour) + t = Time.strptime("3a.m.", "%I%p") + assert_equal(3, t.hour) + t = Time.strptime("3p.m.", "%I%p") + assert_equal(15, t.hour) + t = Time.strptime("3AM", "%I%p") + assert_equal(3, t.hour) + t = Time.strptime("3PM", "%I%p") + assert_equal(15, t.hour) + t = Time.strptime("3A.M.", "%I%p") + assert_equal(3, t.hour) + t = Time.strptime("3P.M.", "%I%p") + assert_equal(15, t.hour) + end + def test_nsec assert_equal(123456789, Time.parse("2000-01-01T00:00:00.123456789+00:00").tv_nsec) end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/