diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-02-11 03:04:23 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-02-11 03:04:23 +0000 |
commit | cd339692eff0568d15b8971738d2e35610d1ae8b (patch) | |
tree | 01f946e5035dfa3783d3680584ce5f81c89890fc /test | |
parent | c25f3d785dd8257fe89959087cd057d4c480296e (diff) | |
download | ruby-cd339692eff0568d15b8971738d2e35610d1ae8b.tar.gz |
* 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
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_defined.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/ruby/test_defined.rb b/test/ruby/test_defined.rb index bae85c9265..2552626b9e 100644 --- a/test/ruby/test_defined.rb +++ b/test/ruby/test_defined.rb @@ -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 |