mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* compile.c (defined_expr): guard the whole expression.
[ruby-dev:45021][Bug#5786] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34555 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
c25f3d785d
commit
cd339692ef
3 changed files with 59 additions and 12 deletions
|
@ -113,15 +113,27 @@ class TestDefined < Test::Unit::TestCase
|
|||
def a?
|
||||
defined?(A)
|
||||
end
|
||||
def b?
|
||||
defined?(A::B)
|
||||
end
|
||||
end
|
||||
|
||||
def test_autoloaded_noload
|
||||
loaded = $".dup
|
||||
$".clear
|
||||
loadpath = $:.dup
|
||||
$:.clear
|
||||
x = TestAutoloadedNoload.new
|
||||
assert_equal("constant", x.a?)
|
||||
assert_nil(x.b?)
|
||||
assert_equal([], $")
|
||||
ensure
|
||||
$".replace(loaded)
|
||||
$:.replace(loadpath)
|
||||
end
|
||||
|
||||
def test_exception
|
||||
bug5786 = '[ruby-dev:45021]'
|
||||
assert_nil(defined?(raise("[Bug#5786]")::A), bug5786)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue