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
yard-0.8.7 spec/handlers/c/alias_handler_spec.rb
challah-1.0.0 vendor/bundle/gems/yard-0.8.6.1/spec/handlers/c/alias_handler_spec.rb
yard-0.8.6.2 spec/handlers/c/alias_handler_spec.rb
challah-1.0.0.beta3 vendor/bundle/gems/yard-0.8.5.2/spec/handlers/c/alias_handler_spec.rb
challah-1.0.0.beta3 vendor/bundle/gems/yard-0.8.6/spec/handlers/c/alias_handler_spec.rb
challah-1.0.0.beta3 vendor/bundle/gems/yard-0.8.6.1/spec/handlers/c/alias_handler_spec.rb
sidekiq-statsd-0.1.1 vendor/ruby/1.9.1/gems/yard-0.8.6.1/spec/handlers/c/alias_handler_spec.rb
sidekiq-statsd-0.1.0 vendor/ruby/1.9.1/gems/yard-0.8.6.1/spec/handlers/c/alias_handler_spec.rb
yard-0.8.6.1 spec/handlers/c/alias_handler_spec.rb
challah-1.0.0.beta2 vendor/bundle/gems/yard-0.8.6/spec/handlers/c/alias_handler_spec.rb
challah-1.0.0.beta2 vendor/bundle/gems/yard-0.8.5.2/spec/handlers/c/alias_handler_spec.rb
yard-0.8.6 spec/handlers/c/alias_handler_spec.rb
challah-1.0.0.beta vendor/bundle/gems/yard-0.8.5.2/spec/handlers/c/alias_handler_spec.rb
challah-1.0.0.beta vendor/bundle/gems/yard-0.8.3/spec/handlers/c/alias_handler_spec.rb
yard-0.8.5.2 spec/handlers/c/alias_handler_spec.rb
yard-0.8.5.1 spec/handlers/c/alias_handler_spec.rb
yard-0.8.5 spec/handlers/c/alias_handler_spec.rb
challah-0.9.1.beta.3 vendor/bundle/gems/yard-0.8.3/spec/handlers/c/alias_handler_spec.rb
yard-0.8.4.1 spec/handlers/c/alias_handler_spec.rb
yard-0.8.4 spec/handlers/c/alias_handler_spec.rb