From 9d96fc17d7ed40ae7e0be723e1ae008cd4d0424a Mon Sep 17 00:00:00 2001 From: nobu Date: Wed, 18 Apr 2012 01:58:49 +0000 Subject: 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 --- test/ruby/test_time_tz.rb | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'test/ruby/test_time_tz.rb') diff --git a/test/ruby/test_time_tz.rb b/test/ruby/test_time_tz.rb index 42c4607bf3..a8229a618a 100644 --- a/test/ruby/test_time_tz.rb +++ b/test/ruby/test_time_tz.rb @@ -1,8 +1,9 @@ require 'test/unit' class TestTimeTZ < Test::Unit::TestCase - def with_tz(tz) - if /linux/ =~ RUBY_PLATFORM || ENV["RUBY_FORCE_TIME_TZ_TEST"] == "yes" + force_tz_test = /linux/ =~ RUBY_PLATFORM || ENV["RUBY_FORCE_TIME_TZ_TEST"] == "yes" + if force_tz_test + def with_tz(tz) old = ENV["TZ"] begin ENV["TZ"] = tz @@ -10,7 +11,9 @@ class TestTimeTZ < Test::Unit::TestCase ensure ENV["TZ"] = old end - else + end + else + def with_tz(tz) if ENV["TZ"] == tz yield end @@ -60,10 +63,12 @@ class TestTimeTZ < Test::Unit::TestCase include 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) - else + end + else + def time_to_s(t) t.to_s end end -- cgit v1.2.3