mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36587 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
59c139306d
commit
f52eefece1
2 changed files with 19 additions and 3 deletions
|
@ -1,3 +1,12 @@
|
|||
Wed Aug 1 05:50:53 2012 Hiroshi Shirosaki <h.shirosaki@gmail.com>
|
||||
|
||||
* 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@ruby-lang.org>
|
||||
|
||||
* class.c (include_class_new): fix duplication of prepended module.
|
||||
|
|
|
@ -199,14 +199,21 @@ class TestRubyOptions < Test::Unit::TestCase
|
|||
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
|
||||
|
|
Loading…
Reference in a new issue