JRuby 1.6.0-RC1のバグの切りわけができない
久々にブログを書いてみました。 Nendoのテストスイートを走らせているのだが、JRuby 1.6.0-RC1のバグっぽい挙動に悩されている。 なぜか、次のように失敗する。( CRuby 1.9.2-p136では正常にパスする ) expectedとgotの文字列を見ても同じように見えるのだが。
現象
ruby -I ./lib /usr/local/bin/rspec -b ./test/nendo_spec.rb
.........F.F..................FFFFFFFFFFFFFFFFFFFFFFF
Failures:
1) Nendo when call evalStr() with literals should
Failure/Error: @nendo.evalStr( ' "日本語" ' ).should eql( '"日本語"' )
expected "\"\xE6\x97\xA5\xE6\x9C\xAC\xE8\xAA\x9E\""
got "\"\xE6\x97\xA5\xE6\x9C\xAC\xE8\xAA\x9E\""
(compared using eql?)
# /usr/local/stow/ruby-1.6.0.RC1-jruby/lib/ruby/gems/1.8/gems/rspec-expectations-2.4.0/lib/rspec/expectations/fail_with.rb:29:in `fail_with'
# /usr/local/stow/ruby-1.6.0.RC1-jruby/lib/ruby/gems/1.8/gems/rspec-expectations-2.4.0/lib/rspec/expectations/handler.rb:19:in `handle_matcher'
# /usr/local/stow/ruby-1.6.0.RC1-jruby/lib/ruby/gems/1.8/gems/rspec-expectations-2.4.0/lib/rspec/expectations/extensions/kernel.rb:27:in `should'
# ./test/nendo_spec.rb:226:in `(root)'
# org/jruby/RubyBasicObject.java:1682:in `instance_eval19'
# /usr/local/stow/ruby-1.6.0.RC1-jruby/lib/ruby/gems/1.8/gems/rspec-core-2.4.0/lib/rspec/core/example.rb:49:in `run'
# /usr/local/stow/ruby-1.6.0.RC1-jruby/lib/ruby/gems/1.8/gems/rspec-core-2.4.0/lib/rspec/core/example.rb:98:in `with_around_hooks'
# /usr/local/stow/ruby-1.6.0.RC1-jruby/lib/ruby/gems/1.8/gems/rspec-core-2.4.0/lib/rspec/core/example.rb:46:in `run'
# /usr/local/stow/ruby-1.6.0.RC1-jruby/lib/ruby/gems/1.8/gems/rspec-core-2.4.0/lib/rspec/core/example.rb:91:in `with_pending_capture'
# org/jruby/RubyKernel.java:1208:in `rbCatch19'
# /usr/local/stow/ruby-1.6.0.RC1-jruby/lib/ruby/gems/1.8/gems/rspec-core-2.4.0/lib/rspec/core/example.rb:90:in `with_pending_capture'
# /usr/local/stow/ruby-1.6.0.RC1-jruby/lib/ruby/gems/1.8/gems/rspec-core-2.4.0/lib/rspec/core/example.rb:45:in `run'
# /usr/local/stow/ruby-1.6.0.RC1-jruby/lib/ruby/gems/1.8/gems/rspec-core-2.4.0/lib/rspec/core/example_group.rb:261:in `run_examples'
# org/jruby/RubyArray.java:2471:in `collect19'
# /usr/local/stow/ruby-1.6.0.RC1-jruby/lib/ruby/gems/1.8/gems/rspec-core-2.4.0/lib/rspec/core/example_group.rb:257:in `run_examples'
# /usr/local/stow/ruby-1.6.0.RC1-jruby/lib/ruby/gems/1.8/gems/rspec-core-2.4.0/lib/rspec/core/example_group.rb:231:in `run'
# /usr/local/stow/ruby-1.6.0.RC1-jruby/lib/ruby/gems/1.8/gems/rspec-core-2.4.0/lib/rspec/core/command_line.rb:27:in `run'
# org/jruby/RubyArray.java:2471:in `collect19'
# /usr/local/stow/ruby-1.6.0.RC1-jruby/lib/ruby/gems/1.8/gems/rspec-core-2.4.0/lib/rspec/core/command_line.rb:27:in `run'
# /usr/local/stow/ruby-1.6.0.RC1-jruby/lib/ruby/gems/1.8/gems/rspec-core-2.4.0/lib/rspec/core/reporter.rb:12:in `report'
# /usr/local/stow/ruby-1.6.0.RC1-jruby/lib/ruby/gems/1.8/gems/rspec-core-2.4.0/lib/rspec/core/command_line.rb:24:in `run'
# /usr/local/stow/ruby-1.6.0.RC1-jruby/lib/ruby/gems/1.8/gems/rspec-core-2.4.0/lib/rspec/core/runner.rb:55:in `run_in_process'
# /usr/local/stow/ruby-1.6.0.RC1-jruby/lib/ruby/gems/1.8/gems/rspec-core-2.4.0/lib/rspec/core/runner.rb:46:in `run'
# /usr/local/stow/ruby-1.6.0.RC1-jruby/lib/ruby/gems/1.8/gems/rspec-core-2.4.0/lib/rspec/core/runner.rb:10:in `autorun'
UTF-8の文字列の扱いがうまくいかないのかな? Nendoの処理系は instance_eval() を使っているので、次のようなspecファイルでも失敗すると予想したが、失敗しない。 t_spec.rb
#!/usr/bin/env ruby
# -*- encoding: utf-8 -*-
#
describe Kernel, "when call evalStr() with literals" do
it "should" do
instance_eval( ' "\"abc\"" ' ).should == '"abc"'
instance_eval( ' "\"日本語\"" ' ).should eql '"日本語"'
end
end
実行結果
$ rspec t_spec.rb
.
Finished in 0.01 seconds
1 example, 0 failures
$
そんなわけで、バグ報告したいけど問題を絞り込めないのでちょっと保留かなー。 CRubyでは動くので、JRuby側に問題があると思うだけどなー。