diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-01-16 09:25:59 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-01-16 09:25:59 +0000 |
commit | e4f1a557fd6f5189c28cd6663b90f8f6c6c1b686 (patch) | |
tree | 55cf5527b0186a806844bf63754fd6e27cebd45e /sample | |
parent | aefad35e2c5ef6077a095b66e2d59602d36f83ef (diff) | |
download | ruby-e4f1a557fd6f5189c28cd6663b90f8f6c6c1b686.tar.gz ruby-e4f1a557fd6f5189c28cd6663b90f8f6c6c1b686.tar.xz ruby-e4f1a557fd6f5189c28cd6663b90f8f6c6c1b686.zip |
* st.c: primes should be primes.
* eval.c (is_defined): method defined? check should honor
protected too.
* eval.c (block_pass): should not pass tainted block, if $SAFE > 0.
* variable.c (rb_mod_remove_cvar): should pass the char*.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@1996 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'sample')
-rw-r--r-- | sample/test.rb | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/sample/test.rb b/sample/test.rb index 7022b4de9..fc2eb5ae0 100644 --- a/sample/test.rb +++ b/sample/test.rb @@ -1313,17 +1313,31 @@ test_ok(defined?($x) == 'global-variable')# returns description foo=5 test_ok(defined?(foo)) # local variable -test_ok(defined?(Array)) # constant +test_ok(defined?(Array)) # constant test_ok(defined?(Object.new)) # method -test_ok(!defined?(Object.print)) # private method -test_ok(defined?(1 == 2)) # operator expression +test_ok(!defined?(Object.print))# private method +test_ok(defined?(1 == 2)) # operator expression + +class Foo + def foo + p :foo + end + protected :foo + def bar(f) + test_ok(defined?(self.foo)) + test_ok(defined?(f.foo)) + end +end +f = Foo.new +test_ok(defined?(f.foo) == nil) +f.bar(f) def defined_test return !defined?(yield) end test_ok(defined_test) # not iterator -test_ok(!defined_test{}) # called as iterator +test_ok(!defined_test{}) # called as iterator test_check "alias" class Alias0 |