aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_defined.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-27 06:12:09 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-27 06:12:09 +0000
commit9473f86fb0ca396adaccf151874604faf47d852e (patch)
treeaa99888eb1cc8acb0b35218de947279d4c3735d1 /test/ruby/test_defined.rb
parent17d8433d276ecc041376e67fea5430df7e97fb21 (diff)
downloadruby-9473f86fb0ca396adaccf151874604faf47d852e.tar.gz
defined? returns nil for toplevel constant lookup
* variable.c (rb_const_defined_0): toplevel constant lookup has been removed, should return nil too. [ruby-core:85142] [Bug #14407] [Fix GH-1800] From: Gonzalo <grzuy0@gmail.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62071 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_defined.rb')
-rw-r--r--test/ruby/test_defined.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/test/ruby/test_defined.rb b/test/ruby/test_defined.rb
index 54f461ff03..9976db3b6f 100644
--- a/test/ruby/test_defined.rb
+++ b/test/ruby/test_defined.rb
@@ -253,4 +253,8 @@ class TestDefined < Test::Unit::TestCase
assert_equal(nil, obj.func_defined_non_existing_func, bug_11212)
assert_equal(true, obj.called, bug_11212)
end
+
+ def test_top_level_constant_not_defined
+ assert_nil(defined?(TestDefined::Object))
+ end
end