dev-ruby/haml: enable ruby34

Signed-off-by: Hans de Graaff <graaff@gentoo.org>
This commit is contained in:
Hans de Graaff
2025-07-25 12:18:32 +02:00
parent e32bf788c6
commit 5201232c70
3 changed files with 88 additions and 2 deletions

View File

@@ -0,0 +1,27 @@
From 4f36be66d080cc57433ae2dbd13984e8361dec4b Mon Sep 17 00:00:00 2001
From: Akira Matsuda <ronnie@dio.jp>
Date: Mon, 19 Aug 2024 04:00:31 +0900
Subject: [PATCH] Backtrace format has been changed since Ruby 3.4
Method names are quoted with ''
https://bugs.ruby-lang.org/issues/16495
Method names include method owner
https://bugs.ruby-lang.org/issues/19117
---
test/haml/engine_test.rb | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/haml/engine_test.rb b/test/haml/engine_test.rb
index f0fe006d7..6cebd913e 100644
--- a/test/haml/engine_test.rb
+++ b/test/haml/engine_test.rb
@@ -97,7 +97,7 @@ def use_test_tracing(options)
unless options[:filename]
# use caller method name as fake filename. useful for debugging
i = -1
- caller[i+=1] =~ /`(.+?)'/ until $1 and $1.index('test_') == 0
+ caller[i+=1] =~ /[`'](?:.+?#)?(.+?)'/ until $1 and $1.index('test_') == 0
options[:filename] = "(#{$1})"
end
options

View File

@@ -0,0 +1,57 @@
From a08d5cd792555621d8e778e4d71db5e88b7292c0 Mon Sep 17 00:00:00 2001
From: Geremia Taglialatela <tagliala.dev@gmail.com>
Date: Sat, 28 Dec 2024 10:27:55 +0100
Subject: [PATCH] Test against 3.4 and fix tests for `Hash#inspect`
Ref: ruby/ruby@a8a0591
Close #1173
---
.github/workflows/test.yml | 1 +
test/haml/engine/old_attribute_test.rb | 2 +-
test/haml/engine/text_test.rb | 2 +-
test/test_helper.rb | 5 +++++
4 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/test/haml/engine/old_attribute_test.rb b/test/haml/engine/old_attribute_test.rb
index c03740341..7570aefce 100644
--- a/test/haml/engine/old_attribute_test.rb
+++ b/test/haml/engine/old_attribute_test.rb
@@ -182,7 +182,7 @@
it 'does not join others' do
assert_render(<<-HTML.unindent, <<-HAML.unindent)
- <a data-value='[{:count=&gt;1}]'></a>
+ <a data-value='[#{render_hash({ count: 1 })}]'></a>
HTML
%a{ data: { value: [count: 1] } }
HAML
diff --git a/test/haml/engine/text_test.rb b/test/haml/engine/text_test.rb
index f72e76cd0..cec239ee8 100644
--- a/test/haml/engine/text_test.rb
+++ b/test/haml/engine/text_test.rb
@@ -6,7 +6,7 @@
skip 'escape is not working well in truffleruby' if RUBY_ENGINE == 'truffleruby'
assert_render(<<-HTML.unindent, <<-'HAML'.unindent)
a3aa" [&quot;1&quot;, 2] b " !
- a{:a=&gt;3}
+ a#{render_hash({ a: 3 })}
<ht2ml>
HTML
#{ "a#{3}a" }a" #{["1", 2]} b " !
diff --git a/test/test_helper.rb b/test/test_helper.rb
index 8a94f3578..40d89bbd4 100644
--- a/test/test_helper.rb
+++ b/test/test_helper.rb
@@ -46,6 +46,11 @@ def assert_haml(haml, options = {})
actual = render_haml(haml, options)
assert_equal expected, actual
end
+
+ # See haml/haml#1173 and ruby/ruby@a8a0591
+ def render_hash(hash)
+ Haml::Util.escape_html(hash)
+ end
end
class Haml::TestCase < BASE_TEST_CLASS

View File

@@ -1,9 +1,9 @@
# Copyright 1999-2024 Gentoo Authors
# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
USE_RUBY="ruby31 ruby32 ruby33"
USE_RUBY="ruby32 ruby33 ruby34"
RUBY_FAKEGEM_BINWRAP=""
@@ -23,6 +23,8 @@ KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~ppc ~ppc64 ~riscv ~sparc ~x86 ~amd64-linux ~
IUSE="doc test"
PATCHES=( "${FILESDIR}/${P}-ruby34-backtrace.patch" "${FILESDIR}/${P}-ruby34.patch" )
ruby_add_rdepend ">=dev-ruby/temple-0.8.2 dev-ruby/thor dev-ruby/tilt:*"
ruby_add_bdepend "