ruby-changes:60638
From: Nobuyoshi <ko1@a...>
Date: Fri, 3 Apr 2020 10:37:00 +0900 (JST)
Subject: [ruby-changes:60638] f49a24201c (master): Refined spec/mspec/tool/remove_old_guards.rb
https://git.ruby-lang.org/ruby.git/commit/?id=f49a24201c From f49a24201c8bbcf9fcb4349174e468a673d14b98 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada <nobu@r...> Date: Fri, 3 Apr 2020 09:42:52 +0900 Subject: Refined spec/mspec/tool/remove_old_guards.rb * Allow spaces around `...` * Matches quotes more precisely * Matches 0 teeny diff --git a/spec/mspec/tool/remove_old_guards.rb b/spec/mspec/tool/remove_old_guards.rb index d6ed619..718e351 100644 --- a/spec/mspec/tool/remove_old_guards.rb +++ b/spec/mspec/tool/remove_old_guards.rb @@ -57,9 +57,10 @@ def search(regexp) https://github.com/ruby/ruby/blob/trunk/spec/mspec/tool/remove_old_guards.rb#L57 end version = Regexp.escape(ARGV.fetch(0)) -remove_guards(/ruby_version_is ["']#{version}["'] do/, true) -remove_guards(/ruby_version_is ["'][0-9.]*["']...["']#{version}["'] do/, false) -remove_guards(/ruby_bug "#\d+", ["'][0-9.]*["']...["']#{version}["'] do/, true) +version += "(?:\\.0)?" if version.count(".") < 2 +remove_guards(/ruby_version_is (["'])#{version}\1 do/, true) +remove_guards(/ruby_version_is (["'])[0-9.]*\1 *... *(["'])#{version}\2 do/, false) +remove_guards(/ruby_bug "#\d+", (["'])[0-9.]*\1 *... *(["'])#{version}\2 do/, true) -search(/["']#{version}["']/) +search(/(["'])#{version}\1/) search(/^\s*#.+#{version}/) -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/