diff options
author | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-04-23 15:23:41 +0000 |
---|---|---|
committer | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-04-23 15:23:41 +0000 |
commit | 563762f6c54ac7f6ceaee49f7212ab56eb2d2d06 (patch) | |
tree | 6b60d0823b07b64079bc16178f31476b560cb88b /test | |
parent | b712455f98ad4e7ef9c44d8384192369aaa77b62 (diff) | |
download | ruby-563762f6c54ac7f6ceaee49f7212ab56eb2d2d06.tar.gz |
* parse.y (primary): remove wrong "fixpos" that caused incorrect
source_location of blocks. [ruby-core:42232] [Bug #5930]
* test/ruby/test_proc.rb: add a test for above.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_proc.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/ruby/test_proc.rb b/test/ruby/test_proc.rb index 686db844ee..3deb5c0109 100644 --- a/test/ruby/test_proc.rb +++ b/test/ruby/test_proc.rb @@ -1059,6 +1059,20 @@ class TestProc < Test::Unit::TestCase assert_equal(@@line_of_attr_accessor_source_location_test, lineno) end + def block_source_location_test(*args, &block) + block.source_location + end + + def test_block_source_location + exp_lineno = __LINE__ + 3 + file, lineno = block_source_location_test(1, + 2, + 3) do + end + assert_match(/^#{ Regexp.quote(__FILE__) }$/, file) + assert_equal(exp_lineno, lineno) + end + def test_splat_without_respond_to def (obj = Object.new).respond_to?(m,*); false end [obj].each do |a, b| |