diff options
author | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-09-05 10:35:30 +0000 |
---|---|---|
committer | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-09-05 10:35:30 +0000 |
commit | 8186c3994e0cf1f91070176af66846d8f1556ec4 (patch) | |
tree | 362b9fc870edb3820ef488a6618baf5669d3aa48 /test/rdoc/test_rdoc_parser_c.rb | |
parent | 0de432c787ece6a2ad88a8694526da29ad663b62 (diff) | |
download | ruby-8186c3994e0cf1f91070176af66846d8f1556ec4.tar.gz |
* lib/rdoc/*, test/rdoc/*: Update rdoc/rdoc master(f191513)
https://github.com/rdoc/rdoc/blob/master/History.rdoc#423--2016--
https://github.com/rdoc/rdoc/blob/master/History.rdoc#422--2016-02-09
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56072 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rdoc/test_rdoc_parser_c.rb')
-rw-r--r-- | test/rdoc/test_rdoc_parser_c.rb | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/test/rdoc/test_rdoc_parser_c.rb b/test/rdoc/test_rdoc_parser_c.rb index fdc303e3e5..09d7c4b16d 100644 --- a/test/rdoc/test_rdoc_parser_c.rb +++ b/test/rdoc/test_rdoc_parser_c.rb @@ -176,6 +176,50 @@ void Init_Blah(void) { assert_equal 'This is a writer', writer.comment.text end + def test_do_attr_rb_attr_2 + content = <<-EOF +void Init_Blah(void) { + cBlah = rb_define_class("Blah", rb_cObject); + + /* + * This is an accessor + */ + rb_attr(cBlah, rb_intern_const("accessor"), 1, 1, Qfalse); + + /* + * This is a reader + */ + rb_attr(cBlah, rb_intern_const("reader"), 1, 0, Qfalse); + + /* + * This is a writer + */ + rb_attr(cBlah, rb_intern_const("writer"), 0, 1, Qfalse); +} + EOF + + klass = util_get_class content, 'cBlah' + + attrs = klass.attributes + assert_equal 3, attrs.length, attrs.inspect + + accessor = attrs.shift + assert_equal 'accessor', accessor.name + assert_equal 'RW', accessor.rw + assert_equal 'This is an accessor', accessor.comment.text + assert_equal @top_level, accessor.file + + reader = attrs.shift + assert_equal 'reader', reader.name + assert_equal 'R', reader.rw + assert_equal 'This is a reader', reader.comment.text + + writer = attrs.shift + assert_equal 'writer', writer.name + assert_equal 'W', writer.rw + assert_equal 'This is a writer', writer.comment.text + end + def test_do_attr_rb_define_attr content = <<-EOF void Init_Blah(void) { |