ruby-changes:24536
From: shirosaki <ko1@a...>
Date: Wed, 1 Aug 2012 05:58:27 +0900 (JST)
Subject: [ruby-changes:24536] shirosaki:r36587 (trunk): test_rubyoptions.rb: fix test failure on Windows
shirosaki 2012-08-01 05:58:08 +0900 (Wed, 01 Aug 2012) New Revision: 36587 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=36587 Log: 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. [ruby-core:46872] [Bug #6813] Modified files: trunk/ChangeLog trunk/test/ruby/test_rubyoptions.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 36586) +++ ChangeLog (revision 36587) @@ -1,3 +1,12 @@ +Wed Aug 1 05:50:53 2012 Hiroshi Shirosaki <h.shirosaki@g...> + + * 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. + [ruby-core:46872] [Bug #6813] + Wed Aug 1 00:33:19 2012 Nobuyoshi Nakada <nobu@r...> * class.c (include_class_new): fix duplication of prepended module. Index: test/ruby/test_rubyoptions.rb =================================================================== --- test/ruby/test_rubyoptions.rb (revision 36586) +++ test/ruby/test_rubyoptions.rb (revision 36587) @@ -199,14 +199,21 @@ end def test_encoding - assert_in_out_err(%w(-Eutf-8), "p '\u3042'", [], /invalid multibyte char/) - assert_in_out_err(%w(--encoding), "", [], /missing argument for --encoding/) assert_in_out_err(%w(--encoding test_ruby_test_rubyoptions_foobarbazqux), "", [], /unknown encoding name - test_ruby_test_rubyoptions_foobarbazqux \(RuntimeError\)/) - assert_in_out_err(%w(--encoding utf-8), "p '\u3042'", [], /invalid multibyte char/) + if /mswin|mingw/ =~ RUBY_PLATFORM && + (str = "\u3042".force_encoding(Encoding.find("locale"))).valid_encoding? + # This result depends on locale because LANG=C doesn't affect locale + # on Windows. + out, err = [str], [] + else + out, err = [], /invalid multibyte char/ + end + assert_in_out_err(%w(-Eutf-8), "puts '\u3042'", out, err) + assert_in_out_err(%w(--encoding utf-8), "puts '\u3042'", out, err) end def test_syntax_check -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/