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.6 spec/handlers/c/alias_handler_spec.rb
yard-0.8.7.5 spec/handlers/c/alias_handler_spec.rb
climine-0.0.7 vendor/bundle/ruby/2.0.0/gems/yard-0.8.7.3/spec/handlers/c/alias_handler_spec.rb
climine-0.0.7 vendor/bundle/ruby/2.1.0/gems/yard-0.8.7.3/spec/handlers/c/alias_handler_spec.rb
climine-0.0.6 vendor/bundle/ruby/2.0.0/gems/yard-0.8.7.3/spec/handlers/c/alias_handler_spec.rb
climine-0.0.5 vendor/bundle/ruby/2.0.0/gems/yard-0.8.7.3/spec/handlers/c/alias_handler_spec.rb
yard-0.8.7.4 spec/handlers/c/alias_handler_spec.rb
climine-0.0.4 vendor/bundle/ruby/2.0.0/gems/yard-0.8.7.3/spec/handlers/c/alias_handler_spec.rb
climine-0.0.3 vendor/bundle/ruby/2.0.0/gems/yard-0.8.7.3/spec/handlers/c/alias_handler_spec.rb
mango-0.8.0 vendor/bundler/ruby/2.1.0/gems/yard-0.8.7.3/spec/handlers/c/alias_handler_spec.rb
mango-0.7.1 vendor/bundler/ruby/2.0.0/gems/yard-0.8.7.3/spec/handlers/c/alias_handler_spec.rb
mango-0.7.0 vendor/bundler/ruby/2.0.0/gems/yard-0.8.7.3/spec/handlers/c/alias_handler_spec.rb
climine-0.0.2 vendor/bundle/ruby/2.0.0/gems/yard-0.8.7.3/spec/handlers/c/alias_handler_spec.rb
climine-0.0.1 vendor/bundle/ruby/2.0.0/gems/yard-0.8.7.3/spec/handlers/c/alias_handler_spec.rb
yard-0.8.7.3 spec/handlers/c/alias_handler_spec.rb
yard-0.8.7.2 spec/handlers/c/alias_handler_spec.rb
candlepin-api-0.4.0 bundle/ruby/gems/yard-0.8.7/spec/handlers/c/alias_handler_spec.rb
candlepin-api-0.4.0 bundle/ruby/1.8/gems/yard-0.8.7/spec/handlers/c/alias_handler_spec.rb
candlepin-api-0.4.0 bundle/ruby/1.9.1/gems/yard-0.8.7/spec/handlers/c/alias_handler_spec.rb
yard-0.8.7.1 spec/handlers/c/alias_handler_spec.rb