I have been trying to get Rails Tests to pass on JRuby & have ran into this issue related to encoding.
Problem:
JRuby is defaulting back to US-ASCII encoding when it should be using UTF-8
Steps to reproduce:
1. git clone https://github.com/rails/rails.git
2. bundle install
3. cd activesupport
4. jruby -w -Ilib:test -Ku test/inflector_test.rb
Expected Result:
Minitest should report Errors/Failed TestCases.
What Actually Happens:
JRuby is defaulting back to US-ASCII encoding when clearly we are specifying UTF via
a) magic comment.
b) command line arugment
As a result Testrun doesn't complete & following Stracktrace is thrown:
ArgumentError: invalid byte sequence in US-ASCII
=== at org/jruby/RubyRegexp.java:1492
each at org/jruby/RubyArray.java:1617
grep at org/jruby/RubyEnumerable.java:489
methods_matching at /home/gaurish/.rvm/gems/jruby-1.7.4@rails-master/gems/minitest-5.0.6/lib/minitest.rb:244
runnable_methods at /home/gaurish/.rvm/gems/jruby-1.7.4@rails-master/gems/minitest-5.0.6/lib/minitest/test.rb:63
run at /home/gaurish/.rvm/gems/jruby-1.7.4@rails-master/gems/minitest-5.0.6/lib/minitest.rb:262
__run at /home/gaurish/code/repo/rails/activesupport/lib/active_support/test_case.rb:31
map at org/jruby/RubyArray.java:2417
__run at /home/gaurish/code/repo/rails/activesupport/lib/active_support/test_case.rb:30
run at /home/gaurish/.rvm/gems/jruby-1.7.4@rails-master/gems/minitest-5.0.6/lib/minitest.rb:113
autorun at /home/gaurish/.rvm/gems/jruby-1.7.4@rails-master/gems/minitest-5.0.6/lib/minitest.rb:46
No such error occurs on MRI & it correctly uses UTF-8 encoding. If we remove Non-ascii chars(https://github.com/rails/rails/blob/master/activesupport/test/inflector_test_cases.rb) from this file, the test work on JRUBY as well.
so I am wondering if this a bug with JRUBY or just the test is wrong?
|