summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2024-02-28 12:57:46 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2024-02-28 13:30:16 +0900
commit05387b590b5ac3b3f72b902292d18e1475db7fb6 (patch)
tree2a58aa43352c47de6549dad068d08253d4509ae2 /test/ruby
parent75a4aa2052d5b34c1e6bb8085426e50ee627d89a (diff)
Update regex patterns with rbinstall.rb
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_default_gems.rb5
1 files changed, 3 insertions, 2 deletions
diff --git a/test/ruby/test_default_gems.rb b/test/ruby/test_default_gems.rb
index 71371b46c3..b9de33cc78 100644
--- a/test/ruby/test_default_gems.rb
+++ b/test/ruby/test_default_gems.rb
@@ -5,10 +5,11 @@ class TestDefaultGems < Test::Unit::TestCase
def self.load(file)
code = File.read(file, mode: "r:UTF-8:-", &:read)
+ # These regex patterns are from load_gemspec method of rbinstall.rb.
# - `git ls-files` is useless under ruby's repository
# - `2>/dev/null` works only on Unix-like platforms
- code.gsub!(/`git.*?`/, '""')
- code.gsub!(/\[git.*?\]/, '[echo]')
+ code.gsub!(/(?:`git[^\`]*`|%x\[git[^\]]*\])\.split\([^\)]*\)/m, '[]')
+ code.gsub!(/IO\.popen\(.*git.*?\)/, '[].each')
eval(code, binding, file)
end