Skip to content

Commit

Permalink
fix missing locale error for ci and refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
monkeyWzr committed Oct 19, 2024
1 parent 99cabd0 commit 3476eef
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions test/irb/test_history.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ def setup
@original_verbose, $VERBOSE = $VERBOSE, nil
@tmpdir = Dir.mktmpdir("test_irb_history_")
setup_envs(home: @tmpdir)
IRB.conf[:LC_MESSAGES] = IRB::Locale.new
save_encodings
IRB.instance_variable_set(:@existing_rc_name_generators, nil)
end
Expand Down Expand Up @@ -148,7 +149,6 @@ def test_history_concurrent_use_readline
end

def test_history_concurrent_use_not_present
IRB.conf[:LC_MESSAGES] = IRB::Locale.new
IRB.conf[:SAVE_HISTORY] = 1
io = TestInputMethodWithRelineHistory.new
io.class::HISTORY.clear
Expand All @@ -165,9 +165,9 @@ def test_history_concurrent_use_not_present

def test_history_different_encodings
IRB.conf[:SAVE_HISTORY] = 2
IRB.__send__(:set_encoding, Encoding::US_ASCII.name)
locale = IRB::Locale.new("en_US.ASCII")
assert_history(<<~EXPECTED_HISTORY.encode(Encoding::US_ASCII), <<~INITIAL_HISTORY.encode(Encoding::UTF_8), <<~INPUT, locale: locale)
IRB.conf[:LC_MESSAGES] = IRB::Locale.new("en_US.ASCII")
IRB.__send__(:set_encoding, Encoding::US_ASCII.name, override: false)
assert_history(<<~EXPECTED_HISTORY.encode(Encoding::US_ASCII), <<~INITIAL_HISTORY.encode(Encoding::UTF_8), <<~INPUT)
????
exit
EXPECTED_HISTORY
Expand Down Expand Up @@ -236,8 +236,7 @@ def history_concurrent_use_for_input_method(input_method)
end
end

def assert_history(expected_history, initial_irb_history, input, input_method = TestInputMethodWithRelineHistory, locale: IRB::Locale.new)
IRB.conf[:LC_MESSAGES] = locale
def assert_history(expected_history, initial_irb_history, input, input_method = TestInputMethodWithRelineHistory)
actual_history = nil
history_file = IRB.rc_file("_history")
ENV["HOME"] = @tmpdir
Expand Down

0 comments on commit 3476eef

Please sign in to comment.