[前][次][番号順一覧][スレッド一覧]

ruby-changes:56924

From: Kazuhiro <ko1@a...>
Date: Sun, 11 Aug 2019 10:16:25 +0900 (JST)
Subject: [ruby-changes:56924] Kazuhiro NISHIYAMA: f731cc0984 (master): Use `end_with?` instead of Regexp with missing escape

https://git.ruby-lang.org/ruby.git/commit/?id=f731cc0984

From f731cc0984560d8dabd211e7b827617fe078cca1 Mon Sep 17 00:00:00 2001
From: Kazuhiro NISHIYAMA <zn@m...>
Date: Sun, 11 Aug 2019 10:15:05 +0900
Subject: Use `end_with?` instead of Regexp with missing escape


diff --git a/tool/lib/test/unit.rb b/tool/lib/test/unit.rb
index 8832022..2d5a32e 100644
--- a/tool/lib/test/unit.rb
+++ b/tool/lib/test/unit.rb
@@ -872,7 +872,7 @@ module Test https://github.com/ruby/ruby/blob/trunk/tool/lib/test/unit.rb#L872
           return File.join(File.dirname(f), basename+'.rb')
         elsif /\Atest_/ !~ basename
           return File.join(File.dirname(f), 'test_'+basename)
-        end if /#{basename}\z/ =~ f # otherwise basename is dirname/
+        end if f.end_with?(basename) # otherwise basename is dirname/
 
         raise ArgumentError, "file not found: #{orig_f}"
       end
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]