From a10ded3ba0f6da6b4f881cd23858aef3d9eb5f29 Mon Sep 17 00:00:00 2001 From: naruse Date: Tue, 12 Feb 2008 06:28:23 +0000 Subject: [PATCH] * bootstraptest/runner.rb, bootstraptest/test_method.rb, enc/depend, instruby.rb, lib/mkmf.rb, lib/test/unit/util/procwrapper.rb, mkconfig.rb, sample/test.rb, template/vm.inc.tmpl, test/ruby/test_stringchar.rb: fixes arround String#gsub. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15443 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 8 ++++++++ bootstraptest/runner.rb | 2 +- bootstraptest/test_method.rb | 2 +- enc/depend | 4 ++-- instruby.rb | 2 +- lib/mkmf.rb | 12 ++++++------ lib/test/unit/util/procwrapper.rb | 2 +- mkconfig.rb | 5 +++-- sample/test.rb | 2 +- template/vm.inc.tmpl | 3 ++- test/ruby/test_stringchar.rb | 2 +- 11 files changed, 27 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index 22abd0e54b..339b321beb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Tue Feb 12 15:27:19 2008 NARUSE, Yui + + * bootstraptest/runner.rb, bootstraptest/test_method.rb, enc/depend, + instruby.rb, lib/mkmf.rb, lib/test/unit/util/procwrapper.rb, + mkconfig.rb, sample/test.rb, template/vm.inc.tmpl, + test/ruby/test_stringchar.rb: fixes arround String#gsub. + + Tue Feb 12 15:11:47 2008 NARUSE, Yui * ext/json/lib/json/pure/generator.rb, diff --git a/bootstraptest/runner.rb b/bootstraptest/runner.rb index 72840c4fa9..b5237c21f5 100644 --- a/bootstraptest/runner.rb +++ b/bootstraptest/runner.rb @@ -264,7 +264,7 @@ def adjust_indent(src) end def untabify(str) - str.gsub(/^\t+/) {|tabs| ' ' * (8 * tabs.size) } + str.gsub(/^\t+/) {' ' * (8 * $&.size) } end def make_srcfile(src) diff --git a/bootstraptest/test_method.rb b/bootstraptest/test_method.rb index 8b5d584e31..2d194cdda4 100644 --- a/bootstraptest/test_method.rb +++ b/bootstraptest/test_method.rb @@ -657,7 +657,7 @@ C1.new.m(1,2,3,4,5,6,7,8,9) tests.each{|setup, methods| setup = setup.dup; setup.strip! - setup = BASE.gsub(//){setup} + setup = BASE.gsub(//, setup) methods.split(/\n/).each{|m| m = m.dup; m.strip! next if m.empty? expr = "#{setup}; #{m}" diff --git a/enc/depend b/enc/depend index d97c9056c3..3b2ef97158 100644 --- a/enc/depend +++ b/enc/depend @@ -46,12 +46,12 @@ $(ENCSODIR)/<%=e%>.$(DLEXT): <%=obj%> echo EXPORTS > <%=df%> echo <%=EXPORT_PREFIX%>Init_<%=File.basename(e)%> >> <%=df%> % end - <%=link_so.sub(/\$\(OBJS\)/) {obj}.sub(/\$\(DEFFILE\)/) {df}.gsub(/-(?:implib|pdb):/) {|s|"#{s}enc/#{e.sub(/[^\/]+\z/, '')}"}%> + <%=link_so.sub(/\$\(OBJS\)/, obj).sub(/\$\(DEFFILE\)/, df.to_s).gsub(/-(?:implib|pdb):/, "\\1enc/#{e.sub(/[^\/]+\z/, '')}")%> % end % dependencies.each do |e| enc/<%=e%>.$(OBJEXT): $(srcdir)/enc/<%=e%>.c - <%=COMPILE_C.sub(/\$\(<(?:.*)\)/) {"$(srcdir)/enc/#{e}.c"}%> + <%=COMPILE_C.sub(/\$\(<(?:.*)\)/, "$(srcdir)/enc/#{e}.c")%> % end clean: diff --git a/instruby.rb b/instruby.rb index 9b07951e89..8380df41fb 100755 --- a/instruby.rb +++ b/instruby.rb @@ -275,7 +275,7 @@ install?(:local, :comm, :bin) do shebang = f.gets body = f.read - if shebang.sub!(/^\#!.*?ruby\b/) {"#!" + ruby_shebang} + if shebang.sub!(/^\#!.*?ruby\b/, "#!" + ruby_shebang) f.rewind f.print shebang, body f.truncate(f.pos) diff --git a/lib/mkmf.rb b/lib/mkmf.rb index 45bf90872d..9629a648ab 100644 --- a/lib/mkmf.rb +++ b/lib/mkmf.rb @@ -1512,10 +1512,10 @@ static: $(STATIC_LIB)#{$extout ? " install-rb" : ""} f.gsub!("/", sep) dir.gsub!("/", sep) sep = ":/="+sep - f.gsub!(/(\$\(\w+)(\))/) {$1+sep+$2} - f.gsub!(/(\$\{\w+)(\})/) {$1+sep+$2} - dir.gsub!(/(\$\(\w+)(\))/) {$1+sep+$2} - dir.gsub!(/(\$\{\w+)(\})/) {$1+sep+$2} + f.gsub!(/(\$\(\w+)(\))/, "\\1#{sep}\\2") + f.gsub!(/(\$\{\w+)(\})/, "\\1#{sep}\\2") + dir.gsub!(/(\$\(\w+)(\))/, "\\1#{sep}\\2") + dir.gsub!(/(\$\{\w+)(\})/, "\\1#{sep}\\2") end mfile.print "\t$(INSTALL_PROG) #{f} #{dir}\n" if defined?($installed_list) @@ -1546,8 +1546,8 @@ static: $(STATIC_LIB)#{$extout ? " install-rb" : ""} if sep f = f.gsub("/", sep) sep = ":/="+sep - f = f.gsub(/(\$\(\w+)(\))/) {$1+sep+$2} - f = f.gsub(/(\$\{\w+)(\})/) {$1+sep+$2} + f = f.gsub(/(\$\(\w+)(\))/, "\\1#{sep}\\2") + f = f.gsub(/(\$\{\w+)(\})/, "\\1#{sep}\\2") else sep = "" end diff --git a/lib/test/unit/util/procwrapper.rb b/lib/test/unit/util/procwrapper.rb index 4d49a52a9d..ad3b4d8a6f 100644 --- a/lib/test/unit/util/procwrapper.rb +++ b/lib/test/unit/util/procwrapper.rb @@ -22,7 +22,7 @@ module Test # Creates a new wrapper for a_proc. def initialize(a_proc) @a_proc = a_proc - @hash = a_proc.inspect.sub(/^(#<#{a_proc.class}:)/){''}.sub(/(>)$/){''}.hex + @hash = a_proc.inspect.sub(/^(#<#{a_proc.class}:)/, '').sub(/(>)$/, '').hex end def hash # :nodoc: diff --git a/mkconfig.rb b/mkconfig.rb index 7815dd1eee..e39307b48b 100755 --- a/mkconfig.rb +++ b/mkconfig.rb @@ -150,7 +150,8 @@ print <