time.c: [DOC] Time#localtime
* time.c: state that Time#localtime does nothing when nothing changes. [ruby-core:87675] [Bug #14880] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63823 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
b53114dd99
commit
482bbde6e2
@ -90,6 +90,19 @@ describe "Time#localtime" do
|
||||
|
||||
t.utc_offset.should == -18000
|
||||
end
|
||||
|
||||
it "does nothing if already in a local time zone" do
|
||||
time = with_timezone("America/New_York") do
|
||||
break Time.new(2005, 2, 27, 22, 50, 0)
|
||||
end
|
||||
zone = time.zone
|
||||
|
||||
with_timezone("Europe/Amsterdam") do
|
||||
time.localtime
|
||||
end
|
||||
|
||||
time.zone.should == zone
|
||||
end
|
||||
end
|
||||
|
||||
describe "with an argument that responds to #to_str" do
|
||||
|
@ -105,6 +105,17 @@ class TestTimeTZ < Test::Unit::TestCase
|
||||
assert_equal(expected, real, m)
|
||||
end
|
||||
|
||||
def test_localtime_zone
|
||||
t = with_tz("America/Los_Angeles") {
|
||||
Time.local(2000, 1, 1)
|
||||
}
|
||||
z1 = t.zone
|
||||
z2 = with_tz(tz="Asia/Singapore") {
|
||||
t.localtime.zone
|
||||
}
|
||||
assert_equal(z2, z1)
|
||||
end
|
||||
|
||||
def test_america_los_angeles
|
||||
with_tz(tz="America/Los_Angeles") {
|
||||
assert_time_constructor(tz, "2007-03-11 03:00:00 -0700", :local, [2007,3,11,2,0,0])
|
||||
|
Loading…
x
Reference in New Issue
Block a user