Sha256: 4eb4a336510bd32cdfd6778d99f604b292900f9839a1451eab42994fdb40e6c3

Contents?: true

Size: 1.26 KB

Versions: 21

Compression:

Stored size: 1.26 KB

Contents

# frozen_string_literal: true
require File.dirname(__FILE__) + "/spec_helper"

RSpec.describe YARD::Handlers::C::OverrideCommentHandler do
  [:class, :module].each do |type|
    it "handles Document-#{type}" do
      parse(<<-eof)
        void something;
        /* Document-#{type}: A
         * Foo bar baz
         */
        void
      eof
      expect(Registry.at('A').type).to eq type
      expect(Registry.at('A').docstring).to eq 'Foo bar baz'
      expect(Registry.at('A').file).to eq '(stdin)'
      expect(Registry.at('A').line).to eq 2
    end
  end

  it "handles multiple class/module combinations" do
    parse(<<-eof)
      /* Document-class: A
       * Document-class: B
       * Document-module: C
       * Foo bar baz
       */
    eof
    expect(Registry.at('A').docstring).to eq 'Foo bar baz'
    expect(Registry.at('B').docstring).to eq 'Foo bar baz'
    expect(Registry.at('C').docstring).to eq 'Foo bar baz'
    expect(Registry.at('C').type).to eq :module
  end

  it "handles Document-class with inheritance" do
    parse(<<-eof)
      /* Document-class: A < B
       * Foo bar baz
       */
      void
    eof
    obj = Registry.at('A')
    expect(obj.type).to eq :class
    expect(obj.docstring).to eq 'Foo bar baz'
    expect(obj.superclass).to eq P('B')
  end
end

Version data entries

21 entries across 20 versions & 4 rubygems

Version Path
yard-0.9.24 spec/handlers/c/override_comment_handler_spec.rb
yard-0.9.23 spec/handlers/c/override_comment_handler_spec.rb
yard-0.9.22 spec/handlers/c/override_comment_handler_spec.rb
yard-0.9.21 spec/handlers/c/override_comment_handler_spec.rb
yard-0.9.20 spec/handlers/c/override_comment_handler_spec.rb
yard-0.9.19 spec/handlers/c/override_comment_handler_spec.rb
yard-0.9.16 spec/handlers/c/override_comment_handler_spec.rb
yard-0.9.15 spec/handlers/c/override_comment_handler_spec.rb
yard-0.9.14 spec/handlers/c/override_comment_handler_spec.rb
yard-0.9.13 spec/handlers/c/override_comment_handler_spec.rb
yard-0.9.12 spec/handlers/c/override_comment_handler_spec.rb
yard-0.9.11 spec/handlers/c/override_comment_handler_spec.rb
yard-0.9.10 spec/handlers/c/override_comment_handler_spec.rb
yard-0.9.9 spec/handlers/c/override_comment_handler_spec.rb
etude_for_ruby-0.1.4 vendor/bundle/ruby/2.4.0/gems/yard-0.9.8/spec/handlers/c/override_comment_handler_spec.rb
etude_for_ruby-0.1.4 vendor/bundle/ruby/2.2.0/gems/yard-0.9.8/spec/handlers/c/override_comment_handler_spec.rb
mdg-1.0.1 vendor/bundle/ruby/2.3.0/gems/yard-0.9.8/spec/handlers/c/override_comment_handler_spec.rb
yard-0.9.8 spec/handlers/c/override_comment_handler_spec.rb
abaci-0.3.0 vendor/bundle/gems/yard-0.9.7/spec/handlers/c/override_comment_handler_spec.rb
yard-0.9.7 spec/handlers/c/override_comment_handler_spec.rb