diff options
author | Benoit Daloze <eregontp@gmail.com> | 2023-08-02 17:08:19 +0200 |
---|---|---|
committer | Benoit Daloze <eregontp@gmail.com> | 2023-08-02 17:13:38 +0200 |
commit | 3c41a04b6cedbace1406d46a20a673f59b1502de (patch) | |
tree | cc48ba17ca43145456f13421267f3d5a0c0bb51f /spec | |
parent | a502cd80a592c90dc76daf06687ce67bdb183d02 (diff) | |
download | ruby-3c41a04b6cedbace1406d46a20a673f59b1502de.tar.gz |
Fix encoding switches when RUBYOPT is empty or only spaces
* Follow-up of dbbc3583ba432c279f07b1fa0afb0a8a9ba50c91 which broke this.
Diffstat (limited to 'spec')
-rw-r--r-- | spec/ruby/command_line/dash_upper_u_spec.rb | 7 |
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' |