From 4709e330cf23e91157da30c58e33017d1ff4433e Mon Sep 17 00:00:00 2001 From: matz Date: Thu, 16 Oct 2008 22:21:09 +0000 Subject: * ruby.c (proc_options): no warning when default_external already set by -E. * test/ruby/test_rubyoptions.rb (TestRubyOptions#test_rubyopt): put -K after -E to set script encoding. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19811 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 8 ++++++++ ruby.c | 3 ++- test/ruby/test_rubyoptions.rb | 4 ++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 73ab994aa4..a960582061 100644 --- a/ChangeLog +++ b/ChangeLog @@ -51,6 +51,14 @@ Thu Oct 16 14:30:30 2008 Nobuyoshi Nakada * instruby.rb (lib): installs all files other than README etc. +Thu Oct 16 08:14:39 2008 Yukihiro Matsumoto + + * ruby.c (proc_options): no warning when default_external already + set by -E. + + * test/ruby/test_rubyoptions.rb (TestRubyOptions#test_rubyopt): + put -K after -E to set script encoding. + Thu Oct 16 06:20:36 2008 Yukihiro Matsumoto * test/ruby/test_transcode.rb (TestTranscode#test_errors): diff --git a/ruby.c b/ruby.c index edce4777bc..881ebe7fb2 100644 --- a/ruby.c +++ b/ruby.c @@ -814,7 +814,8 @@ proc_options(int argc, char **argv, struct cmdline_options *opt) } if (enc_name) { opt->src.enc.name = rb_str_new2(enc_name); - set_external_encoding_once(opt, enc_name, 0); + if (!opt->ext.enc.name) + opt->ext.enc.name = opt->src.enc.name; } s++; } diff --git a/test/ruby/test_rubyoptions.rb b/test/ruby/test_rubyoptions.rb index af4ca282ee..ebe6023b04 100644 --- a/test/ruby/test_rubyoptions.rb +++ b/test/ruby/test_rubyoptions.rb @@ -208,8 +208,8 @@ class TestRubyOptions < Test::Unit::TestCase ENV['RUBYOPT'] = '-T4' assert_in_out_err([], "", [], /no program input from stdin allowed in tainted mode \(SecurityError\)/) - ENV['RUBYOPT'] = '-KN -Eus-ascii' - assert_in_out_err(%w(-KU -Eutf-8), "p '\u3042'") do |r, e| + 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_equal([], e) end -- cgit v1.2.3