split method definitions

* test/ruby/test_time_tz.rb (TestTimeTZ#with_tz, TestTimeTZ#time_to_s):
  split method definitions.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35380 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2012-04-18 01:58:49 +00:00
parent 62885f1ed1
commit 9d96fc17d7

View File

@ -1,8 +1,9 @@
require 'test/unit' require 'test/unit'
class TestTimeTZ < Test::Unit::TestCase class TestTimeTZ < Test::Unit::TestCase
def with_tz(tz) force_tz_test = /linux/ =~ RUBY_PLATFORM || ENV["RUBY_FORCE_TIME_TZ_TEST"] == "yes"
if /linux/ =~ RUBY_PLATFORM || ENV["RUBY_FORCE_TIME_TZ_TEST"] == "yes" if force_tz_test
def with_tz(tz)
old = ENV["TZ"] old = ENV["TZ"]
begin begin
ENV["TZ"] = tz ENV["TZ"] = tz
@ -10,7 +11,9 @@ class TestTimeTZ < Test::Unit::TestCase
ensure ensure
ENV["TZ"] = old ENV["TZ"] = old
end end
else end
else
def with_tz(tz)
if ENV["TZ"] == tz if ENV["TZ"] == tz
yield yield
end end
@ -60,10 +63,12 @@ class TestTimeTZ < Test::Unit::TestCase
include Util include Util
extend Util extend Util
def time_to_s(t) if RUBY_VERSION < "1.9"
if RUBY_VERSION < "1.9" def time_to_s(t)
t.strftime("%Y-%m-%d %H:%M:%S ") + format_gmtoff(t.gmtoff) t.strftime("%Y-%m-%d %H:%M:%S ") + format_gmtoff(t.gmtoff)
else end
else
def time_to_s(t)
t.to_s t.to_s
end end
end end