8000 Test for "%p" in Time.strptime · github/ruby@e52b102 · GitHub
[go: up one dir, main page]

Skip to content

Commit e52b102

Browse files
committed
Test for "%p" in Time.strptime
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66752 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent bbd1e83 commit e52b102

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

test/test_time.rb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,25 @@ def test_strptime_j
509509
assert_equal(1, t.day)
510510
end
511511

512+
def test_strptime_p
513+
t = Time.strptime("3am", "%I%p")
514+
assert_equal(3, t.hour)
515+
t = Time.strptime("3pm", "%I%p")
516+
assert_equal(15, t.hour)
517+
t = Time.strptime("3a.m.", "%I%p")
518+
assert_equal(3, t.hour)
519+
t = Time.strptime("3p.m.", "%I%p")
520+
assert_equal(15, t.hour)
521+
t = Time.strptime("3AM", "%I%p")
522+
assert_equal(3, t.hour)
523+
t = Time.strptime("3PM", "%I%p")
524+
assert_equal(15, t.hour)
525+
t = Time.strptime("3A.M.", "%I%p")
526+
assert_equal(3, t.hour)
527+
t = Time.strptime("3P.M.", "%I%p")
528+
assert_equal(15, t.hour)
529+
end
530+
512531
def test_nsec
513532
assert_equal(123456789, Time.parse("2000-01-01T00:00:00.123456789+00:00").tv_nsec)
514533
end

0 commit comments

Comments
 (0)
0