summaryrefslogtreecommitdiff
path: root/spec/ruby/command_line/dash_upper_u_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/command_line/dash_upper_u_spec.rb')
-rw-r--r--spec/ruby/command_line/dash_upper_u_spec.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/spec/ruby/command_line/dash_upper_u_spec.rb b/spec/ruby/command_line/dash_upper_u_spec.rb
index d62718b095..15854e7b73 100644
--- a/spec/ruby/command_line/dash_upper_u_spec.rb
+++ b/spec/ruby/command_line/dash_upper_u_spec.rb
@@ -6,6 +6,13 @@ describe "ruby -U" do
options: '-U').should == 'UTF-8'
end
+ it "sets Encoding.default_internal to UTF-8 when RUBYOPT is empty or only spaces" do
+ ruby_exe('p Encoding.default_internal',
+ options: '-U', env: { 'RUBYOPT' => '' }).should == "#<Encoding:UTF-8>\n"
+ ruby_exe('p Encoding.default_internal',
+ options: '-U', env: { 'RUBYOPT' => ' ' }).should == "#<Encoding:UTF-8>\n"
+ end
+
it "does nothing different if specified multiple times" do
ruby_exe('print Encoding.default_internal.name',
options: '-U -U').should == 'UTF-8'