Sha256: 929c93a2113f162f2b24ff744ba2ceb42f22ae0a186226f29b115d4f8a7d7b8a

Contents?: true

Size: 1.22 KB

Versions: 3

Compression:

Stored size: 1.22 KB

Contents

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

describe YARD::Handlers::C::PathHandler do
  it 'should track variable names defined under namespaces' do
    parse_init <<-eof
      mFoo = rb_define_module("Foo");
      cBar = rb_define_class_under(mFoo, "Bar", rb_cObject);
      rb_define_method(cBar, "foo", foo, 1);
    eof
    Registry.at('Foo::Bar').should_not be_nil
    Registry.at('Foo::Bar#foo').should_not be_nil
  end

  it 'should track variable names defined under namespaces' do
    parse_init <<-eof
      mFoo = rb_define_module("Foo");
      cBar = rb_define_class_under(mFoo, "Bar", rb_cObject);
      mBaz = rb_define_module_under(cBar, "Baz");
      rb_define_method(mBaz, "foo", foo, 1);
    eof
    Registry.at('Foo::Bar::Baz').should_not be_nil
    Registry.at('Foo::Bar::Baz#foo').should_not be_nil
  end

  it "should handle rb_path2class() calls" do
    parse_init <<-eof
      somePath = rb_path2class("Foo::Bar::Baz")
      mFoo = rb_define_module("Foo");
      cBar = rb_define_class_under(mFoo, "Bar", rb_cObject);
      mBaz = rb_define_module_under(cBar, "Baz");
      rb_define_method(somePath, "foo", foo, 1);
    eof
    Registry.at('Foo::Bar::Baz#foo').should_not be_nil
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
deg-yard-0.8.7.4 spec/handlers/c/path_handler_spec.rb
deg-yard-0.8.7.3 spec/handlers/c/path_handler_spec.rb
deg-yard-0.8.7.1 spec/handlers/c/path_handler_spec.rb