Bug #6813

TestRubyOptions#test_encoding failure on Windows

Added by Hiroshi Shirosaki about 3 years ago. Updated about 3 years ago.

[ruby-core:46872]
Status:Closed
Priority:Normal
Assignee:Luis Lavena
ruby -v:ruby 2.0.0dev (2012-07-30 trunk 36577) [x64-mswin64_100] Backport:

Description

TestRubyOptions#test_encoding fails. This failure depends on cmd code page.
With chcp 932 the test passes, but with chcp 65001, 1252 and so on the test fails.

[ 9/38] TestRubyOptions#test_encoding = 0.04 s
1) Failure:
test_encoding(TestRubyOptions) [C:/Users/hiroshi/work/ruby/test/ruby/test_rubyop
tions.rb:202]:
<[]> expected but was
<["\"\xE3\x81\x82\""]>.

This test depends on STDIN encoding which is determined system locale.
And LANG=C is set when invoking ruby.

https://github.com/ruby/ruby/blob/trunk/test/ruby/envutil.rb#L48

But LANG doesn't affect locale with trunk ruby on Windows by the following commit.
https://github.com/ruby/ruby/commit/5a2758ed

So test results would differ according to cmd code page.

I've attached a patch to work with not 932 code page.

0001-Fix-test_encoding-failure-on-Windows.patch Magnifier (1.66 KB) Hiroshi Shirosaki, 07/30/2012 11:36 PM

Associated revisions

Revision 36587
Added by shirosaki about 3 years ago

test_rubyoptions.rb: fix test failure on Windows

  • test/ruby/test_rubyoptions.rb (TestRubyOptions#test_encoding): Fix test_encoding failure on Windows. With chcp 65001, 1252 and 437, test_encoding failed. Test result depends on locale because LANG environment variable doesn't affect locale on Windows. [Bug #6813]

Revision 36587
Added by shirosaki about 3 years ago

test_rubyoptions.rb: fix test failure on Windows

  • test/ruby/test_rubyoptions.rb (TestRubyOptions#test_encoding): Fix test_encoding failure on Windows. With chcp 65001, 1252 and 437, test_encoding failed. Test result depends on locale because LANG environment variable doesn't affect locale on Windows. [Bug #6813]

History

#1 Updated by Usaku NAKAMURA about 3 years ago

Commit it, please.

#2 Updated by Anonymous about 3 years ago

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

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


test_rubyoptions.rb: fix test failure on Windows

  • test/ruby/test_rubyoptions.rb (TestRubyOptions#test_encoding): Fix test_encoding failure on Windows. With chcp 65001, 1252 and 437, test_encoding failed. Test result depends on locale because LANG environment variable doesn't affect locale on Windows. [Bug #6813]

Also available in: Atom PDF