Sha256: 7814f849b26a5fd8d7824bce24ed21eba4572fbb1340af3b3ee4e0b7a50a1d25

Contents?: true

Size: 1.88 KB

Versions: 4

Compression:

Stored size: 1.88 KB

Contents

require File.join(File.dirname(__FILE__), '..', 'spec_helper')
begin require 'continuation'; rescue LoadError; end unless RUBY18

describe YARD::Parser::CParser do
  before(:all) do
    file = File.join(File.dirname(__FILE__), 'examples', 'array.c.txt')
    @parser = Parser::CParser.new(IO.read(file)).parse

    override_file = File.join(File.dirname(__FILE__), 'examples', 'override.c.txt')
    @override_parser = Parser::CParser.new(IO.read(override_file)).parse
  end
  
  describe '#parse' do
    it "should parse Array class" do
      obj = YARD::Registry.at('Array')
      obj.should_not be_nil
      obj.docstring.should_not be_blank
    end
    
    it "should parse method" do
      obj = YARD::Registry.at('Array#initialize')
      obj.docstring.should_not be_blank
      obj.tags(:overload).size.should > 1
    end
  end

  describe '#find_override_comment' do
    it "should parse GMP::Z class" do
      z = YARD::Registry.at('GMP::Z')
      z.should_not be_nil
      z.docstring.should_not be_blank
    end

    it "should parse GMP::Z methods w/ bodies" do
      add = YARD::Registry.at('GMP::Z#+')
      add.docstring.should_not be_blank
      add.source.should_not be_nil
      add.source.should_not be_empty

      add_self = YARD::Registry.at('GMP::Z#+')
      add_self.docstring.should_not be_blank
      add_self.source.should_not be_nil
      add_self.source.should_not be_empty

      sqrtrem = YARD::Registry.at('GMP::Z#+')
      sqrtrem.docstring.should_not be_blank
      sqrtrem.source.should_not be_nil
      sqrtrem.source.should_not be_empty
    end

    it "should parse GMP::Z methods w/o bodies" do
      neg = YARD::Registry.at('GMP::Z#neg')
      neg.docstring.should_not be_blank
      neg.source.should be_nil

      neg_self = YARD::Registry.at('GMP::Z#neg')
      neg_self.docstring.should_not be_blank
      neg_self.source.should be_nil
    end
  end
end if CONTINUATIONS_SUPPORTED

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
yard-0.6.8 spec/parser/c_parser_spec.rb
yard-0.6.7 spec/parser/c_parser_spec.rb
yard-0.6.6 spec/parser/c_parser_spec.rb
yard-0.6.5 spec/parser/c_parser_spec.rb