mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Test for "%p" in Time.strptime
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66752 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
bbd1e83e5a
commit
e52b102c36
1 changed files with 19 additions and 0 deletions
|
@ -509,6 +509,25 @@ class TestTimeExtension < Test::Unit::TestCase # :nodoc:
|
||||||
assert_equal(1, t.day)
|
assert_equal(1, t.day)
|
||||||
end
|
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
|
def test_nsec
|
||||||
assert_equal(123456789, Time.parse("2000-01-01T00:00:00.123456789+00:00").tv_nsec)
|
assert_equal(123456789, Time.parse("2000-01-01T00:00:00.123456789+00:00").tv_nsec)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue