Sha256: 072bc5f47c517b9a6e726fd3f0eea99c81cfc3e83c8bc9b6999676c57a8ceac4
Contents?: true
Size: 977 Bytes
Versions: 8
Compression:
Stored size: 977 Bytes
Contents
require File.dirname(__FILE__) + "/spec_helper" describe YARD::Handlers::C::AliasHandler do it "allows defining of aliases (rb_define_alias)" do parse <<-eof /* FOO */ VALUE foo(VALUE x) { int value = x; } void Init_Foo() { rb_cFoo = rb_define_class("Foo", rb_cObject); rb_define_method(rb_cFoo, "foo", foo, 1); rb_define_alias(rb_cFoo, "bar", "foo"); } eof expect(Registry.at('Foo#bar')).to be_is_alias expect(Registry.at('Foo#bar').docstring).to eq 'FOO' end it "allows defining of aliases (rb_define_alias) of attributes" do parse <<-eof /* FOO */ VALUE foo(VALUE x) { int value = x; } void Init_Foo() { rb_cFoo = rb_define_class("Foo", rb_cObject); rb_define_attr(rb_cFoo, "foo", 1, 0); rb_define_alias(rb_cFoo, "foo?", "foo"); } eof expect(Registry.at('Foo#foo')).to be_reader expect(Registry.at('Foo#foo?')).to be_is_alias end end
Version data entries
8 entries across 7 versions & 2 rubygems