Skip to content

Commit

Permalink
Fix encoding switches when RUBYOPT is empty or only spaces
Browse files Browse the repository at this point in the history
* Follow-up of ruby/ruby@dbbc358 which broke this.
  • Loading branch information
eregon committed Aug 2, 2023
1 parent 01c120c commit d2e65e8
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions command_line/dash_upper_u_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@
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'
Expand Down

0 comments on commit d2e65e8

Please sign in to comment.