From 54950e023c051cee2e5a540f9ff7372080038b6f Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA Date: Fri, 5 Apr 2024 15:10:29 +0900 Subject: [PATCH] Suppressed ":52:in 'Array#each'" from backtrace --- lib/rake/backtrace.rb | 1 + test/test_rake_backtrace.rb | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/lib/rake/backtrace.rb b/lib/rake/backtrace.rb index 31ff05450..c87f2f991 100644 --- a/lib/rake/backtrace.rb +++ b/lib/rake/backtrace.rb @@ -10,6 +10,7 @@ module Backtrace # :nodoc: all map { |f| File.expand_path(f) }. reject { |s| s.nil? || s =~ /^ *$/ } SUPPRESSED_PATHS_RE = SUPPRESSED_PATHS.map { |f| Regexp.quote(f) }.join("|") + SUPPRESSED_PATHS_RE << "|^" SUPPRESSED_PATHS_RE << "|^org\\/jruby\\/\\w+\\.java" if Object.const_defined?(:RUBY_ENGINE) and RUBY_ENGINE == "jruby" diff --git a/test/test_rake_backtrace.rb b/test/test_rake_backtrace.rb index f605384e2..e4c7fb0ff 100644 --- a/test/test_rake_backtrace.rb +++ b/test/test_rake_backtrace.rb @@ -32,6 +32,14 @@ def test_near_system_dir_isnt_suppressed assert_equal paths, actual end + + def test_ruby_array_each_suppressed + paths = [":52:in 'Array#each'"] + + actual = Rake::Backtrace.collapse(paths) + + assert_equal [], actual + end end class TestRakeBacktrace < Rake::TestCase # :nodoc: