diff options
author | hogelog <konbu.komuro@gmail.com> | 2023-12-02 03:03:58 +0900 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2023-12-01 18:04:03 +0000 |
commit | ef466ac931dcb37f98fc89eba526c2593e1cddb0 (patch) | |
tree | 225edb11f0bf01cf1569ce2f365fe57bac901177 /test/irb | |
parent | 73440e1ef21e1dd7ca590e402d37b835b9b1f0bb (diff) | |
download | ruby-ef466ac931dcb37f98fc89eba526c2593e1cddb0.tar.gz |
[ruby/irb] Scrub past history input before split
(https://github.com/ruby/irb/pull/795)
* Scrub past history input before split
* Don't rewrite ENV["LANG"]
https://github.com/ruby/irb/commit/0f344f66d9
Diffstat (limited to 'test/irb')
-rw-r--r-- | test/irb/test_history.rb | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/test/irb/test_history.rb b/test/irb/test_history.rb index 868c05369c..b211e87bed 100644 --- a/test/irb/test_history.rb +++ b/test/irb/test_history.rb @@ -148,6 +148,23 @@ module TestIRB ENV["IRBRC"] = backup_irbrc end + def test_history_different_encodings + backup_default_external = Encoding.default_external + IRB.conf[:SAVE_HISTORY] = 2 + Encoding.default_external = Encoding::US_ASCII + 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 + 😀 + INITIAL_HISTORY + exit + INPUT + ensure + Encoding.default_external = backup_default_external + end + private def history_concurrent_use_for_input_method(input_method) @@ -179,11 +196,11 @@ module TestIRB 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 |