summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-01-08 07:45:04 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-01-08 07:45:04 +0000
commite52b102c36dc1dd609a97149e99edc7d1f96b7a4 (patch)
tree322cf008c0c4cbbd8a090987ee27c4a13d641cca /test
parentbbd1e83e5aa15f2f5fd3afa569de04bbd9c21eec (diff)
Test for "%p" in Time.strptime
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66752 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/test_time.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/test_time.rb b/test/test_time.rb
index fb30bea723..e4fea31945 100644
--- a/test/test_time.rb
+++ b/test/test_time.rb
@@ -509,6 +509,25 @@ class TestTimeExtension < Test::Unit::TestCase # :nodoc:
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