diff options
| author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-07-12 14:46:46 +0000 |
|---|---|---|
| committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-07-12 14:46:46 +0000 |
| commit | 98ee4d64f070a484bc9159010bb0fc727f297f7e (patch) | |
| tree | 5b0556449748a13d6085048487dec4c6d94d64d2 /test | |
| parent | d333161cec851f0370df25d85f77631121a06123 (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: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@24054 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
| -rw-r--r-- | test/ruby/test_proc.rb | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/ruby/test_proc.rb b/test/ruby/test_proc.rb index 83ef8f38d..89ae569e3 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 |
