summaryrefslogtreecommitdiff
path: root/test/ruby/test_defined.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-10-02 03:00:23 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-10-02 03:00:23 +0000
commit83740fa4bda976d6aef50a452a9dd433b5446af1 (patch)
tree69c889559913cdd75cca9d04a906c49e6e79ef39 /test/ruby/test_defined.rb
parent18ef8f10782e202f1605ff2d3d59241f62989b67 (diff)
* variable.c (rb_const_defined_0): look up constants in Object as
well. [ruby-dev:21458] * test/ruby/test_defined.rb (TestDefined::test_defined): test for constants. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4649 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_defined.rb')
-rw-r--r--test/ruby/test_defined.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/test/ruby/test_defined.rb b/test/ruby/test_defined.rb
index e53778f75f..d386b4bddc 100644
--- a/test/ruby/test_defined.rb
+++ b/test/ruby/test_defined.rb
@@ -24,10 +24,13 @@ class TestDefined < Test::Unit::TestCase
assert(defined?($x)) # global variable
assert_equal('global-variable', defined?($x))# returns description
+ assert_nil(defined?(foo)) # undefined
foo=5
assert(defined?(foo)) # local variable
- assert(defined?(::Array)) # constant !! Array -> ::Array
+ assert(defined?(Array)) # constant
+ assert(defined?(::Array)) # toplevel constant
+ assert(defined?(File::Constants)) # nested constant
assert(defined?(Object.new)) # method
assert(!defined?(Object.print)) # private method
assert(defined?(1 == 2)) # operator expression