[#38392] Enumerable#gather_each — Tanaka Akira <akr@...>

ときに、複数行をまとめて扱いたいことがあります。

47 messages 2009/05/09
[#38394] Re: Enumerable#gather_each — ujihisa <ujihisa@...> 2009/05/09

ujihisaと申します。

[#38400] Re: Enumerable#gather_each — Yukihiro Matsumoto <matz@...> 2009/05/09

まつもと ゆきひろです

[#38399] Re: Enumerable#gather_each — "Akinori MUSHA" <knu@...> 2009/05/09

At Sat, 9 May 2009 15:30:20 +0900,

[#38405] Re: Enumerable#gather_each — Tanaka Akira <akr@...> 2009/05/10

In article <86r5yy2nrg.knu@iDaemons.org>,

[#38417] Re: Enumerable#gather_each — "Akinori MUSHA" <knu@...> 2009/05/10

At Sun, 10 May 2009 10:08:47 +0900,

[#38524] [Bug #1503] -Kuをつけた時、/[#{s}]/n と Regexp.new("[#{s}]",nil,"n") で実行結果が異なる — sinnichi eguchi <redmine@...>

Bug #1503: -Kuをつけた時、/[#{s}]/n と Regexp.new("[#{s}]",nil,"n") で実行結果が異なる

8 messages 2009/05/22

[ruby-dev:38492] [Bug: trunk] test_encode_xmlschema depends upon system's time zone

From: zunda <zunda616e@...>
Date: 2009-05-18 21:09:37 UTC
List: ruby-dev #38492
zundaと申します

ruby 1.9.2dev (2009-05-18 trunk 23484) [i686-linux]で、
make test-allが下記のように失敗します。

 10) Failure:
test_encode_xmlschema(TestTimeExtention) [/home/zunda/local/src/ruby-trunk/test/test_time.rb:167]:
<"1970-01-01T09:00:00.666+09:00"> expected but was
<"1969-12-31T14:00:00.666-10:00">.

このテストの結果は、テストを実行している環境のタイムゾーンに依存
しているようです。

失敗する例
$ TZ=HST ./miniruby -I./lib -I.ext/common -I./- -r./ext/purelib.rb  ./runruby.rb --extout=.ext --
./test/test_time.rb 
Loaded suite ./test/test_time
Started
...F.................
Finished in 0.035415 seconds.

  1) Failure:
test_encode_xmlschema(TestTimeExtention) [./test/test_time.rb:167]:
<"1970-01-01T09:00:00.666+09:00"> expected but was
<"1969-12-31T14:00:00.666-10:00">.

21 tests, 195 assertions, 1 failures, 0 errors, 0 skips

成功する例
$ TZ=Japan ./miniruby -I./lib -I.ext/common -I./- -r./ext/purelib.rb  ./runruby.rb --extout=.ext --
./test/test_time.rb 
Loaded suite ./test/test_time
Started
.....................
Finished in 0.032904 seconds.

21 tests, 205 assertions, 0 failures, 0 errors, 0 skips

例えば、手元では下記のような変更でどちらの場合もテストが成功する
ようになりました。

以上、ご参考まで。

Index: test/test_time.rb
===================================================================
--- test/test_time.rb	(revision 23485)
+++ test/test_time.rb	(working copy)
@@ -2,6 +2,15 @@
 require 'test/unit'
 
 class TestTimeExtention < Test::Unit::TestCase # :nodoc:
+  def setup
+    @tzorig = ENV['TZ']
+    ENV['TZ'] = 'Japan'
+  end
+
+  def teardown
+    ENV['TZ'] = @tzorig
+  end
+
   def test_rfc822
     assert_equal(Time.utc(1976, 8, 26, 14, 30) + 4 * 3600,
                  Time.rfc2822("26 Aug 76 14:30 EDT"))


--------------------------------------
Power up the Internet with Yahoo! Toolbar.
http://pr.mail.yahoo.co.jp/toolbar/

In This Thread

Prev Next