Sha256: 4cade806ec6956f526563cb8af79e5df3dc6f25ff276a352ee807d1f6e7a784b

Contents?: true

Size: 973 Bytes

Versions: 68

Compression:

Stored size: 973 Bytes

Contents

require File.dirname(__FILE__) + "/spec_helper"

describe YARD::Handlers::C::AliasHandler do
  it "should allow 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

    Registry.at('Foo#bar').should be_is_alias
    Registry.at('Foo#bar').docstring.should == 'FOO'
  end

  it "should allow 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

    Registry.at('Foo#foo').should be_reader
    Registry.at('Foo#foo?').should be_is_alias
  end
end

Version data entries

68 entries across 52 versions & 7 rubygems

Version Path
challah-0.6.2 vendor/bundle/gems/yard-0.8.2.1/spec/handlers/c/alias_handler_spec.rb
yard-0.8.2.1 spec/handlers/c/alias_handler_spec.rb
challah-0.6.1 vendor/bundle/gems/yard-0.8.1/spec/handlers/c/alias_handler_spec.rb
challah-0.6.1 vendor/bundle/gems/yard-0.8.2/spec/handlers/c/alias_handler_spec.rb
yard-0.8.2 spec/handlers/c/alias_handler_spec.rb
challah-0.6.0 vendor/bundle/gems/yard-0.8.1/spec/handlers/c/alias_handler_spec.rb
yard-0.8.1 spec/handlers/c/alias_handler_spec.rb
yard-0.8.0 spec/handlers/c/alias_handler_spec.rb