diff options
author | wanabe <wanabe@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-03-22 11:44:17 +0000 |
---|---|---|
committer | wanabe <wanabe@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-03-22 11:44:17 +0000 |
commit | 91533255f89e4e8529b2a4b59902aecc4a6c4bba (patch) | |
tree | db654157c616b1dcd966c3a1f4f73408f02ea3d2 /test | |
parent | c46f71399ae54967e7247ac4df0c26adeddbffd6 (diff) | |
download | ruby-91533255f89e4e8529b2a4b59902aecc4a6c4bba.tar.gz |
add a test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27017 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_proc.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/ruby/test_proc.rb b/test/ruby/test_proc.rb index f6fd5c8ea0..5e04d465ca 100644 --- a/test/ruby/test_proc.rb +++ b/test/ruby/test_proc.rb @@ -761,6 +761,31 @@ class TestProc < Test::Unit::TestCase assert_equal(@@line_of_source_location_test, lineno, 'Bug #2427') end + @@line_of_attr_reader_source_location_test = __LINE__ + 3 + @@line_of_attr_writer_source_location_test = __LINE__ + 3 + @@line_of_attr_accessor_source_location_test = __LINE__ + 3 + attr_reader :attr_reader_source_location_test + attr_writer :attr_writer_source_location_test + attr_accessor :attr_accessor_source_location_test + + def test_attr_source_location + file, lineno = method(:attr_reader_source_location_test).source_location + assert_match(/^#{ Regexp.quote(__FILE__) }$/, file) + assert_equal(@@line_of_attr_reader_source_location_test, lineno) + + file, lineno = method(:attr_writer_source_location_test=).source_location + assert_match(/^#{ Regexp.quote(__FILE__) }$/, file) + assert_equal(@@line_of_attr_writer_source_location_test, lineno) + + file, lineno = method(:attr_accessor_source_location_test).source_location + assert_match(/^#{ Regexp.quote(__FILE__) }$/, file) + assert_equal(@@line_of_attr_accessor_source_location_test, lineno) + + file, lineno = method(:attr_accessor_source_location_test=).source_location + assert_match(/^#{ Regexp.quote(__FILE__) }$/, file) + assert_equal(@@line_of_attr_accessor_source_location_test, lineno) + end + def test_splat_without_respond_to def (obj = Object.new).respond_to?(m); false end [obj].each do |a, b| |