commit: 90065ab4af9bb6a10fab844bd48c843dfe8da9d5 Author: Hans de Graaff <graaff <AT> gentoo <DOT> org> AuthorDate: Tue Nov 12 17:11:03 2024 +0000 Commit: Hans de Graaff <graaff <AT> gentoo <DOT> org> CommitDate: Tue Nov 12 17:11:50 2024 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=90065ab4
dev-ruby/irb: fix tests Backport an upstream patch to fix encoding issues with tests. Closes: https://bugs.gentoo.org/943271 Signed-off-by: Hans de Graaff <graaff <AT> gentoo.org> dev-ruby/irb/files/irb-1.14.1-test-encoding.patch | 70 +++++++++++++++++++++++ dev-ruby/irb/irb-1.14.1.ebuild | 2 + 2 files changed, 72 insertions(+) diff --git a/dev-ruby/irb/files/irb-1.14.1-test-encoding.patch b/dev-ruby/irb/files/irb-1.14.1-test-encoding.patch new file mode 100644 index 000000000000..4347a5b554ba --- /dev/null +++ b/dev-ruby/irb/files/irb-1.14.1-test-encoding.patch @@ -0,0 +1,70 @@ +From 7f385bc19badd2100b76e8b2404be5be46306bf6 Mon Sep 17 00:00:00 2001 +From: Go <[email protected]> +Date: Sun, 20 Oct 2024 15:18:04 +0900 +Subject: [PATCH] Improve history test's encoding setting (#1022) + +* improve history test's encoding setting + +* fix missing locale error for ci and refactoring +--- + test/irb/test_history.rb | 17 +++++++++-------- + 1 file changed, 9 insertions(+), 8 deletions(-) + +diff --git a/test/irb/test_history.rb b/test/irb/test_history.rb +index 791eef1ac..15c16ed89 100644 +--- a/test/irb/test_history.rb ++++ b/test/irb/test_history.rb +@@ -10,17 +10,20 @@ + module TestIRB + class HistoryTest < TestCase + def setup ++ @conf_backup = IRB.conf.dup + @original_verbose, $VERBOSE = $VERBOSE, nil + @tmpdir = Dir.mktmpdir("test_irb_history_") + setup_envs(home: @tmpdir) +- @backup_default_external = Encoding.default_external ++ IRB.conf[:LC_MESSAGES] = IRB::Locale.new ++ save_encodings + IRB.instance_variable_set(:@existing_rc_name_generators, nil) + end + + def teardown ++ IRB.conf.replace(@conf_backup) + IRB.instance_variable_set(:@existing_rc_name_generators, nil) + teardown_envs +- Encoding.default_external = @backup_default_external ++ restore_encodings + $VERBOSE = @original_verbose + FileUtils.rm_rf(@tmpdir) + end +@@ -146,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 +@@ -163,9 +165,9 @@ def test_history_concurrent_use_not_present + + def test_history_different_encodings + IRB.conf[:SAVE_HISTORY] = 2 +- Encoding.default_external = Encoding::US_ASCII +- 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 +@@ -234,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 diff --git a/dev-ruby/irb/irb-1.14.1.ebuild b/dev-ruby/irb/irb-1.14.1.ebuild index 578774e8bd35..32391e23f906 100644 --- a/dev-ruby/irb/irb-1.14.1.ebuild +++ b/dev-ruby/irb/irb-1.14.1.ebuild @@ -20,6 +20,8 @@ SLOT="0" KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~loong ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~arm64-macos ~ppc-macos ~x64-macos ~x64-solaris" IUSE="test" +PATCHES=( "${FILESDIR}/${P}-test-encoding.patch" ) + # Ensure a new enough eselect-ruby is present to avoid clobbering the # irb bin and man page. ruby_add_rdepend "
