Project

General

Profile

Actions

Bug #500

closed

TZ=HSTでFailure: test_strftime(TestTime)

Added by znz (Kazuhiro NISHIYAMA) over 15 years ago. Updated almost 13 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
Backport:
[ruby-dev:35992]

Description

=begin
http://zunda.freeshell.org/d/20080825.html#p04
によるとローカルのタイムゾーンによっては失敗することがあるようです。

% env TZ=HST ruby-trunk -v test/ruby/test_time.rb -n /strftime/
ruby 1.9.0 (2008-08-25 revision 18832) [i686-linux]
Loaded suite test/ruby/test_time
Started
test/ruby/test_time.rb:377: warning: strftime called with empty format string
F
Finished in 0.01258855 seconds.

  1. Failure:
    test_strftime(TestTime) [test/ruby/test_time.rb:381]:
    <"Sat"> expected but was
    <"Fri">.

1 tests, 26 assertions, 1 failures, 0 errors
=end

Actions #1

Updated by shugo (Shugo Maeda) over 15 years ago

=begin
前田です。

2008/08/27 1:23 Kazuhiro NISHIYAMA :

http://zunda.freeshell.org/d/20080825.html#p04
によるとローカルのタイムゾーンによっては失敗することがあるようです。

% env TZ=HST ruby-trunk -v test/ruby/test_time.rb -n /strftime/
ruby 1.9.0 (2008-08-25 revision 18832) [i686-linux]
Loaded suite test/ruby/test_time
Started
test/ruby/test_time.rb:377: warning: strftime called with empty format string
F
Finished in 0.01258855 seconds.

遠藤さんがr15399で追加されたテストのようですが、もともとどういう意図のテスト
でしょうか?
とりあえず、以下のように変えれば環境変数TZの値によらずテストが通るようには
なりますが…。

Index: test/ruby/test_time.rb

--- test/ruby/test_time.rb (revision 18897)
+++ test/ruby/test_time.rb (working copy)
@@ -378,7 +378,8 @@
assert_equal("foo\0bar\x0000\x0000\x0000", T2000.strftime("foo\0bar\0%H\0%M
\0%S"))
assert_equal("foo" * 1000, T2000.strftime("foo" * 1000))

  • assert_equal("Sat", Time.at(946684800).strftime("%a"))
  • t = Time.mktime(2000, 1, 1)

  • assert_equal("Sat", t.strftime("%a"))

    t = Time.at(946684800, 123456.789)
    assert_equal("123", t.strftime("%3N"))

--
Shugo Maeda

=end

Actions #2

Updated by mame (Yusuke Endoh) over 15 years ago

=begin
遠藤です。

2008/08/28 22:35 Shugo Maeda :

2008/08/27 1:23 Kazuhiro NISHIYAMA :

http://zunda.freeshell.org/d/20080825.html#p04
によるとローカルのタイムゾーンによっては失敗することがあるようです。

% env TZ=HST ruby-trunk -v test/ruby/test_time.rb -n /strftime/
ruby 1.9.0 (2008-08-25 revision 18832) [i686-linux]
Loaded suite test/ruby/test_time
Started
test/ruby/test_time.rb:377: warning: strftime called with empty format string
F
Finished in 0.01258855 seconds.

遠藤さんがr15399で追加されたテストのようですが、もともとどういう意図のテスト
でしょうか?

すみません。追加したときの記憶がすでにありませんが、strftime("%a") の
戻り値をテストしたかっただけだと思われます。ですので、

とりあえず、以下のように変えれば環境変数TZの値によらずテストが通るようには
なりますが…。

これでいいと思います。ありがとうございます。コミットしておきます。

--
Yusuke ENDOH

=end

Actions #3

Updated by mame (Yusuke Endoh) over 15 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

=begin
Applied in changeset r18901.
=end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0