From b1dc78b023d49459bea8d2b94d741fb432c76a3b Mon Sep 17 00:00:00 2001 From: Yusuke Endoh Date: Tue, 12 Dec 2023 10:28:19 +0900 Subject: [PATCH 1/2] Prevent a warning: setting Encoding.default_external --- test/irb/test_history.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/irb/test_history.rb b/test/irb/test_history.rb index b211e87be..755346d44 100644 --- a/test/irb/test_history.rb +++ b/test/irb/test_history.rb @@ -149,8 +149,10 @@ def test_history_concurrent_use_not_present end def test_history_different_encodings + verbose_bak = nil backup_default_external = Encoding.default_external IRB.conf[:SAVE_HISTORY] = 2 + $VERBOSE = nil 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) @@ -163,6 +165,7 @@ def test_history_different_encodings INPUT ensure Encoding.default_external = backup_default_external + $VERBOSE = verbose_bak end private From 73be29efbd907ea5ecabe8a4eec1ac02d48d0731 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Tue, 12 Dec 2023 11:06:27 +0900 Subject: [PATCH 2/2] Save $VERBOSE properly --- test/irb/test_history.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/irb/test_history.rb b/test/irb/test_history.rb index 755346d44..f7ba2b9d3 100644 --- a/test/irb/test_history.rb +++ b/test/irb/test_history.rb @@ -149,10 +149,9 @@ def test_history_concurrent_use_not_present end def test_history_different_encodings - verbose_bak = nil backup_default_external = Encoding.default_external IRB.conf[:SAVE_HISTORY] = 2 - $VERBOSE = nil + verbose_bak, $VERBOSE = $VERBOSE, nil 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)