mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* compile.c, insns.def: change return value of "defined?"
for $&, $1, ... . If such variables are defined, return "global-variable". * test/ruby/test_defined.rb: add tests. * bootstraptest/test_syntax.rb: fix a test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14031 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
8e09ab045f
commit
b0986a8f82
5 changed files with 46 additions and 10 deletions
|
@ -248,7 +248,7 @@ assert_equal %q{["method", "method", "method", "method", nil, nil, "method", "me
|
|||
end
|
||||
C.new.test + [defined?(C.new.m3)]
|
||||
}
|
||||
assert_equal %q{[nil, nil, nil, nil, "$1", "$2", nil, nil]}, %q{
|
||||
assert_equal %q{[nil, nil, nil, nil, "global-variable", "global-variable", nil, nil]}, %q{
|
||||
$ans = [defined?($1), defined?($2), defined?($3), defined?($4)]
|
||||
/(a)(b)/ =~ 'ab'
|
||||
$ans + [defined?($1), defined?($2), defined?($3), defined?($4)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue