[ruby-dev:39345] [Bug #2111] Error:test_rm_f(TestFileUtils)

View: New views
11 Messages — Rating Filter:   Alert me  

[ruby-dev:39345] [Bug #2111] Error:test_rm_f(TestFileUtils)

by Usaku NAKAMURA :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Bug #2111: Error:test_rm_f(TestFileUtils)
http://redmine.ruby-lang.org/issues/show/2111

起票者: Kazuhiro NISHIYAMA
ステータス: Open, 優先度: Normal
ruby -v: ruby 1.9.2dev (2009-09-17 trunk 24982) [i686-linux]

rm_f の引数の意味が FileUtils.rm_f と mkmf.rb の rm_f で違うため、
mkmf と rake が require されていると test_rm_f が mkmf.rb の
rm_f で Dir[*files] の files が配列の配列になっていてエラーになります。

rm_f の違いとしては FileUtils.rm_f は
 rm_f(list, options = {})
で複数ファイルは配列でしか指定できないのに対して、
mkmf.rb の方の rm_f は
 rm_f(*files)
となっていて、複数引数でも指定できるようになっています。

さらに mkmf.rb の方は Dir.[] も通すので、グロブの
ワイルドカードなどになる文字が含まれているときの
挙動が変わると思います。

% ruby-trunk -r rake -r mkmf -v test/fileutils/test_fileutils.rb -n test_rm_f
ruby 1.9.2dev (2009-09-17 trunk 24982) [i686-linux]
Loaded suite test/fileutils/test_fileutils
Started
cp data/a tmp/rmsrc
cp data/all tmp/rmsrc
cp data/random tmp/rmsrc
cp data/zero tmp/rmsrc
E
Finished in 0.013124 seconds.

  1) Error:
test_rm_f(TestFileUtils):
TypeError: can't convert Array into String
    test/fileutils/test_fileutils.rb:425:in `test_rm_f'

1 tests, 7 assertions, 0 failures, 1 errors, 0 skips
%


----------------------------------------
http://redmine.ruby-lang.org


[ruby-dev:39346] [Bug #2111](Closed) Error:test_rm_f(TestFileUtils)

by Usaku NAKAMURA :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

チケット #2111 が更新されました。 (by Nobuyoshi Nakada)

ステータス OpenからClosedに変更
進捗 % 0から100に変更

Applied in changeset r24984.
----------------------------------------
http://redmine.ruby-lang.org/issues/show/2111

----------------------------------------
http://redmine.ruby-lang.org


[ruby-dev:39347] [Bug #2111](Open) Error:test_rm_f(TestFileUtils)

by Usaku NAKAMURA :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

チケット #2111 が更新されました。 (by Kazuhiro NISHIYAMA)

ステータス ClosedからOpenに変更

後半の件についてテストを追加したので reopen します。

% ruby-trunk test/fileutils/test_fileutils.rb -n test_rm_f
Loaded suite test/fileutils/test_fileutils
Started
.
Finished in 0.014927 seconds.

1 tests, 15 assertions, 0 failures, 0 errors, 0 skips
% ruby-trunk -r rake -r mkmf test/fileutils/test_fileutils.rb -n test_rm_f
Loaded suite test/fileutils/test_fileutils
Started
cp data/a tmp/rmsrc
cp data/all tmp/rmsrc
cp data/random tmp/rmsrc
cp data/zero tmp/rmsrc
touch tmp/rmtmp1
touch tmp/rmtmp2
touch tmp/rmtmp3
touch tmp/rmtmp4
touch tmp/[rmtmp]
F
Finished in 0.018555 seconds.

  1) Failure:
test_rm_f(TestFileUtils) [test/fileutils/test_fileutils.rb:447]:
file not exist: tmp/[rmtmp].
Expected block to return true value.

1 tests, 15 assertions, 1 failures, 0 errors, 0 skips

----------------------------------------
http://redmine.ruby-lang.org/issues/show/2111

----------------------------------------
http://redmine.ruby-lang.org


[ruby-dev:39348] [Bug #2111](Closed) Error:test_rm_f(TestFileUtils)

by Usaku NAKAMURA :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

チケット #2111 が更新されました。 (by Anonymous)

ステータス OpenからClosedに変更

Applied in changeset r24987.
----------------------------------------
http://redmine.ruby-lang.org/issues/show/2111

----------------------------------------
http://redmine.ruby-lang.org


[ruby-dev:39349] [Bug #2111](Open) Error:test_rm_f(TestFileUtils)

by Usaku NAKAMURA :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

チケット #2111 が更新されました。 (by Kazuhiro NISHIYAMA)

ステータス ClosedからOpenに変更

タイミングが悪かったのでもう一度reopen。

include する順番によって include したクラスと Object の間に FileUtils が入ったり入らなかったりするのも問題の原因の一つだと思うのですが、どうでしょうか。

% ruby-trunk -r fileutils -e '
class C1
  p ancestors                                                                
  include FileUtils                                              
  p ancestors                                
  require "rake"                
  p ancestors    
end
class C2
  p ancestors
  include FileUtils
  p ancestors
end'
[C1, Object, Kernel, BasicObject]
[C1, FileUtils, FileUtils::StreamUtils_, Object, Kernel, BasicObject]
[C1, FileUtils, FileUtils::StreamUtils_, Object, RakeFileUtils, FileUtils, FileUtils::StreamUtils_, Kernel, BasicObject]
[C2, Object, RakeFileUtils, FileUtils, FileUtils::StreamUtils_, Kernel, BasicObject]
[C2, Object, RakeFileUtils, FileUtils, FileUtils::StreamUtils_, Kernel, BasicObject]
%
----------------------------------------
http://redmine.ruby-lang.org/issues/show/2111

----------------------------------------
http://redmine.ruby-lang.org


[ruby-dev:39528] [Bug #2111](Feedback) Error:test_rm_f(TestFileUtils)

by Usaku NAKAMURA :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

チケット #2111 が更新されました。 (by Yui NARUSE)

ステータス OpenからFeedbackに変更

なおってますよね?
----------------------------------------
http://redmine.ruby-lang.org/issues/show/2111

----------------------------------------
http://redmine.ruby-lang.org


[ruby-dev:39532] [Bug #2111](Open) Error:test_rm_f(TestFileUtils)

by Usaku NAKAMURA :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

チケット #2111 が更新されました。 (by Kazuhiro NISHIYAMA)

ステータス FeedbackからOpenに変更

直っていないように見えます。

% ruby-trunk -v
ruby 1.9.2dev (2009-10-22 trunk 25429) [i686-linux]
% ruby-trunk -r rake -r mkmf test/fileutils/test_fileutils.rb
(略)
  1) Failure:
test_rm_pathname(TestFileUtils) [test/fileutils/test_fileutils.rb:456]:
file not exist: tmp/[rmtmp].
Expected block to return true value.

72 tests, 371 assertions, 1 failures, 0 errors, 0 skips
%
----------------------------------------
http://redmine.ruby-lang.org/issues/show/2111

----------------------------------------
http://redmine.ruby-lang.org


[ruby-dev:39879] [Bug #2111](Closed) Error:test_rm_f(TestFileUtils)

by Usaku NAKAMURA :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

チケット #2111 が更新されました。 (by Yui NARUSE)

ステータス OpenからClosedに変更

This issue was solved with changeset r26090.
Kazuhiro, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.

----------------------------------------
http://redmine.ruby-lang.org/issues/show/2111

----------------------------------------
http://redmine.ruby-lang.org


[ruby-dev:39882] [Bug #2111] Error:test_rm_f(TestFileUtils)

by Usaku NAKAMURA :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

チケット #2111 が更新されました。 (by Kazuhiro NISHIYAMA)


include FileUtils をした時の rm_f の挙動を確認するテストのはずなのに
FileUtils.rm_f を使うように変更しても良いのでしょうか?
----------------------------------------
http://redmine.ruby-lang.org/issues/show/2111

----------------------------------------
http://redmine.ruby-lang.org


[ruby-dev:39883] [Bug #2111] Error:test_rm_f(TestFileUtils)

by Usaku NAKAMURA :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

チケット #2111 が更新されました。 (by Yui NARUSE)


> include FileUtils をした時の rm_f の挙動を確認するテストのはずなのに

む、あの行はこのチケット用ですか。
ならばあの行が存在すること自体が誤りでしょう。
include の順番のテストが欲しいならば 別に用意するべきで、FileUtils でやるべきではありません。
----------------------------------------
http://redmine.ruby-lang.org/issues/show/2111

----------------------------------------
http://redmine.ruby-lang.org


[ruby-dev:39884] [Bug #2111] Error:test_rm_f(TestFileUtils)

by Usaku NAKAMURA :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

チケット #2111 が更新されました。 (by Kazuhiro NISHIYAMA)


> include の順番のテストが欲しいならば 別に用意するべきで、FileUtils でやるべきではありません。

include の順番のテストではなく、 include FileUtils した FileUtils のメソッドのテストかと思っていました。

確実に FileUtils のメソッドをテストしたいのなら include の順番の影響を受けないように、 include FileUtils をやめて、他もすべて FileUtils.rm_f などにした方が良いのではないでしょうか?
----------------------------------------
http://redmine.ruby-lang.org/issues/show/2111

----------------------------------------
http://redmine.ruby-lang.org