Skip to content

Commit

Permalink
Don't rewrite ENV["LANG"]
Browse files Browse the repository at this point in the history
  • Loading branch information
hogelog committed Dec 1, 2023
1 parent c2c3bb7 commit be6bb20
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions test/irb/test_history.rb
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,11 @@ def test_history_concurrent_use_not_present

def test_history_different_encodings
backup_default_external = Encoding.default_external
backup_lang = ENV["LANG"]
backup_lang = ENV["IRB_LANG"]
IRB.conf[:SAVE_HISTORY] = 2
ENV["LANG"] = "C"
Encoding.default_external = Encoding::US_ASCII
assert_history(<<~EXPECTED_HISTORY.encode(Encoding::US_ASCII), <<~INITIAL_HISTORY.encode(Encoding::UTF_8), <<~INPUT)
locale = IRB::Locale.new("C")
assert_history(<<~EXPECTED_HISTORY.encode(Encoding::US_ASCII), <<~INITIAL_HISTORY.encode(Encoding::UTF_8), <<~INPUT, locale: locale)
????
exit
EXPECTED_HISTORY
Expand All @@ -163,7 +163,7 @@ def test_history_different_encodings
exit
INPUT
ensure
ENV["LANG"] = backup_lang
ENV["IRB_LANG"] = backup_lang
Encoding.default_external = backup_default_external
end

Expand Down Expand Up @@ -198,11 +198,11 @@ def history_concurrent_use_for_input_method(input_method)
end
end

def assert_history(expected_history, initial_irb_history, input, input_method = TestInputMethodWithRelineHistory)
def assert_history(expected_history, initial_irb_history, input, input_method = TestInputMethodWithRelineHistory, locale: IRB::Locale.new)
backup_verbose, $VERBOSE = $VERBOSE, nil
backup_home = ENV["HOME"]
backup_xdg_config_home = ENV.delete("XDG_CONFIG_HOME")
IRB.conf[:LC_MESSAGES] = IRB::Locale.new
IRB.conf[:LC_MESSAGES] = locale
actual_history = nil
Dir.mktmpdir("test_irb_history_") do |tmpdir|
ENV["HOME"] = tmpdir
Expand Down

0 comments on commit be6bb20

Please sign in to comment.