summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-07-12 14:46:46 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-07-12 14:46:46 +0000
commit073598064efc483260ecb17bc66412ba7f9b8062 (patch)
tree5b0556449748a13d6085048487dec4c6d94d64d2 /test
parent9331ca8fc28cec57f04dcbb1c70e4ff6494833dd (diff)
merges r23956 from trunk into ruby_1_9_1.
-- * vm_insnhelper.c (vm_yield_setup_block_args): restores the first arg where is overwritten at funcall. [ruby-core:24139] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@24054 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_proc.rb26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/ruby/test_proc.rb b/test/ruby/test_proc.rb
index 83ef8f38dd..89ae569e34 100644
--- a/test/ruby/test_proc.rb
+++ b/test/ruby/test_proc.rb
@@ -673,4 +673,30 @@ class TestProc < Test::Unit::TestCase
}.call(1,2,3,4,5)
assert_equal([1,2,[3],4,5], r, "[ruby-core:19485]")
end
+
+ def test_to_s
+ assert_match(/^#<Proc:0x\h+@#{ Regexp.quote(__FILE__) }:\d+>$/, proc {}.to_s)
+ assert_match(/^#<Proc:0x\h+@#{ Regexp.quote(__FILE__) }:\d+ \(lambda\)>$/, lambda {}.to_s)
+ assert_match(/^#<Proc:0x\h+ \(lambda\)>$/, method(:p).to_proc.to_s)
+ x = proc {}
+ x.taint
+ assert(x.to_s.tainted?)
+ end
+
+ def source_location_test
+ __LINE__
+ end
+
+ def test_source_location
+ file, lineno = method(:source_location_test).source_location
+ assert_match(/^#{ Regexp.quote(__FILE__) }$/, file)
+ assert_equal(source_location_test - 1, lineno)
+ end
+
+ def test_splat_without_respond_to
+ def (obj = Object.new).respond_to?(m); false end
+ [obj].each do |a, b|
+ assert_equal([obj, nil], [a, b], '[ruby-core:24139]')
+ end
+ end
end