diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-07-04 16:01:01 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-07-04 16:01:01 +0000 |
commit | 007c9aa2bf0ca503001e5ee2c2fc73566a09fbfc (patch) | |
tree | 898052bb5d330c3a4065ea0b71ea36e2fb165965 /test | |
parent | 87c25d897b4c9cef0c2031ddd9e75474383a2f04 (diff) | |
download | ruby-007c9aa2bf0ca503001e5ee2c2fc73566a09fbfc.tar.gz |
* ruby.c (proc_options): warn only if -K and -w option is specified.
see also r36274 [Feature #5206]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36310 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_rubyoptions.rb | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/test/ruby/test_rubyoptions.rb b/test/ruby/test_rubyoptions.rb index 4ef974a677..029eff07d4 100644 --- a/test/ruby/test_rubyoptions.rb +++ b/test/ruby/test_rubyoptions.rb @@ -121,9 +121,17 @@ class TestRubyOptions < Test::Unit::TestCase assert_in_out_err(%w(-KU), "p '\u3042'") do |r, e| assert_equal("\"\u3042\"", r.join.force_encoding(Encoding::UTF_8)) end - assert_in_out_err(%w(-KE -e) + [""], "", [], /-Ke/) - assert_in_out_err(%w(-KS -e) + [""], "", [], /-Ks/) - assert_in_out_err(%w(-KN -e) + [""], "", [], /-Kn/) + line = '-eputs"\xc2\xa1".encoding' + env = {'RUBYOPT' => nil} + assert_in_out_err([env, '-Ke', line], "", ["EUC-JP"], []) + assert_in_out_err([env, '-KE', line], "", ["EUC-JP"], []) + assert_in_out_err([env, '-Ks', line], "", ["Windows-31J"], []) + assert_in_out_err([env, '-KS', line], "", ["Windows-31J"], []) + assert_in_out_err([env, '-Ku', line], "", ["UTF-8"], []) + assert_in_out_err([env, '-KU', line], "", ["UTF-8"], []) + assert_in_out_err([env, '-Kn', line], "", ["ASCII-8BIT"], []) + assert_in_out_err([env, '-KN', line], "", ["ASCII-8BIT"], []) + assert_in_out_err([env, '-wKe', line], "", ["EUC-JP"], /-K/) end def test_version @@ -235,7 +243,7 @@ class TestRubyOptions < Test::Unit::TestCase ENV['RUBYOPT'] = '-Eus-ascii -KN' assert_in_out_err(%w(-Eutf-8 -KU), "p '\u3042'") do |r, e| assert_equal("\"\u3042\"", r.join.force_encoding(Encoding::UTF_8)) - assert_match(/-Ku/, e.join) + assert_equal([], e) end ensure @@ -287,9 +295,9 @@ class TestRubyOptions < Test::Unit::TestCase assert_in_out_err([], "#! /test_r_u_b_y_test_r_u_b_y_options_foobarbazqux -foo -bar\r\np 1\r\n", [], /: no Ruby script found in input/) - assert_in_out_err([], "#!ruby -KU -Eutf-8\r\np \"\u3042\"\r\n") do |r, e| + assert_in_out_err([{'RUBYOPT' => nil}], "#!ruby -KU -Eutf-8\r\np \"\u3042\"\r\n") do |r, e| assert_equal("\"\u3042\"", r.join.force_encoding(Encoding::UTF_8)) - assert_match(/-Ku/, e.join) + assert_equal([], e) end bug4118 = '[ruby-dev:42680]' |