mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
40d8d38909
commit
a10ded3ba0
11 changed files with 27 additions and 17 deletions
|
@ -1,3 +1,11 @@
|
|||
Tue Feb 12 15:27:19 2008 NARUSE, Yui <naruse@ruby-lang.org>
|
||||
|
||||
* 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 <naruse@ruby-lang.org>
|
||||
|
||||
* ext/json/lib/json/pure/generator.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)
|
||||
|
|
|
@ -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(/<TEST>/){setup}
|
||||
setup = BASE.gsub(/<TEST>/, setup)
|
||||
methods.split(/\n/).each{|m| m = m.dup; m.strip!
|
||||
next if m.empty?
|
||||
expr = "#{setup}; #{m}"
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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)
|
||||
|
|
12
lib/mkmf.rb
12
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
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -150,7 +150,8 @@ print <<EOS
|
|||
MAKEFILE_CONFIG = {}
|
||||
CONFIG.each{|k,v| MAKEFILE_CONFIG[k] = v.dup}
|
||||
def RbConfig::expand(val, config = CONFIG)
|
||||
val.gsub!(/\\$\\$|\\$\\(([^()]+)\\)|\\$\\{([^{}]+)\\}/) do |var|
|
||||
val.gsub!(/\\$\\$|\\$\\(([^()]+)\\)|\\$\\{([^{}]+)\\}/) do
|
||||
var = $&
|
||||
if !(v = $1 || $2)
|
||||
'$'
|
||||
elsif key = config[v = v[/\\A[^:]+(?=(?::(.*?)=(.*))?\\z)/]]
|
||||
|
@ -158,7 +159,7 @@ print <<EOS
|
|||
config[v] = false
|
||||
RbConfig::expand(key, config)
|
||||
config[v] = key
|
||||
key = key.gsub(/\#{Regexp.quote(pat)}(?=\\s|\\z)/n) {sub} if pat
|
||||
key = key.gsub(/\#{Regexp.quote(pat)}(?=\\s|\\z)/n, sub) if pat
|
||||
key
|
||||
else
|
||||
var
|
||||
|
|
|
@ -1495,7 +1495,7 @@ $x = <<END;
|
|||
ABCD
|
||||
ABCD
|
||||
END
|
||||
$x.gsub!(/((.|\n)*?)B((.|\n)*?)D/){$1+$3}
|
||||
$x.gsub!(/((.|\n)*?)B((.|\n)*?)D/, '\1\3')
|
||||
test_ok($x == "AC\nAC\n")
|
||||
|
||||
test_ok("foobar" =~ /foo(?=(bar)|(baz))/)
|
||||
|
|
|
@ -13,7 +13,8 @@
|
|||
|
||||
<%=
|
||||
line = 15
|
||||
vm_body.gsub(/\n|__CURRENT_LINE__|__CURRENT_FILE__/){|e|
|
||||
vm_body.gsub(/\n|__CURRENT_LINE__|__CURRENT_FILE__/){
|
||||
e = $&
|
||||
case e
|
||||
when '__CURRENT_LINE__'
|
||||
line.to_s
|
||||
|
|
|
@ -34,7 +34,7 @@ class TestStringchar < Test::Unit::TestCase
|
|||
ABCD
|
||||
ABCD
|
||||
END
|
||||
$x.gsub!(/((.|\n)*?)B((.|\n)*?)D/){$1+$3}
|
||||
$x.gsub!(/((.|\n)*?)B((.|\n)*?)D/m ,'\1\3')
|
||||
assert_equal("AC\nAC\n", $x)
|
||||
|
||||
assert("foobar" =~ /foo(?=(bar)|(baz))/)
|
||||
|
|
Loading…
Reference in a new issue