blob: ff1d2a860bb9bb2660a5481343bae907f112f310 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
require_relative 'spec_helper'
describe YARD::MRuby::Handlers::C::Header::FunctionHandler do
it "should register functions" do
header_line <<-eof
MRB_API void mrb_foo( void );
eof
expect(Registry.at('mrb_foo')).not_to be_nil
end
it "should find docstrings attached to functions" do
header_line <<-eof
/* DOCSTRING */
MRB_API void mrb_foo( void );
eof
foo = Registry.at('mrb_foo')
expect(foo.docstring).to eq 'DOCSTRING'
end
it "should store the return type" do
header_line <<-eof
MRB_API mrb_value mrb_foo( void );
eof
foo = Registry.at('mrb_foo')
expect(foo.tag(:return).types).to eq ['mrb_value']
end
it "should keep return type independently from docs" do
header_line <<-eof
/**
* @return DOCSTRING
*/
MRB_API mrb_value mrb_foo( void );
eof
foo = Registry.at('mrb_foo')
expect(foo.tag(:return).text).to eq 'DOCSTRING'
expect(foo.tag(:return).types).to eq ['mrb_value']
end
end
|