yard 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of yard might be problematic. Click here for more details.
- data/ChangeLog +585 -1
- data/README.md +10 -2
- data/benchmarks/yri_cache.rb +19 -0
- data/bin/yri +1 -26
- data/docs/WhatsNew.md +99 -0
- data/lib/rubygems_plugin.rb +2 -0
- data/lib/yard.rb +2 -2
- data/lib/yard/autoload.rb +9 -4
- data/lib/yard/cli/base.rb +26 -0
- data/lib/yard/cli/yard_graph.rb +2 -9
- data/lib/yard/cli/yardoc.rb +93 -33
- data/lib/yard/cli/yri.rb +128 -0
- data/lib/yard/code_objects/base.rb +16 -5
- data/lib/yard/code_objects/class_object.rb +11 -4
- data/lib/yard/code_objects/method_object.rb +11 -1
- data/lib/yard/code_objects/proxy.rb +5 -2
- data/lib/yard/code_objects/root_object.rb +1 -0
- data/lib/yard/core_ext/file.rb +1 -1
- data/lib/yard/core_ext/hash.rb +15 -0
- data/lib/yard/core_ext/module.rb +2 -2
- data/lib/yard/core_ext/string.rb +66 -0
- data/lib/yard/core_ext/symbol_hash.rb +1 -1
- data/lib/yard/docstring.rb +5 -5
- data/lib/yard/handlers/base.rb +10 -4
- data/lib/yard/handlers/processor.rb +3 -4
- data/lib/yard/handlers/ruby/attribute_handler.rb +3 -2
- data/lib/yard/handlers/ruby/legacy/attribute_handler.rb +2 -2
- data/lib/yard/handlers/ruby/legacy/method_handler.rb +7 -1
- data/lib/yard/handlers/ruby/method_handler.rb +7 -1
- data/lib/yard/logging.rb +11 -1
- data/lib/yard/parser/c_parser.rb +407 -0
- data/lib/yard/parser/ruby/ast_node.rb +2 -2
- data/lib/yard/parser/ruby/legacy/ruby_lex.rb +3 -4
- data/lib/yard/parser/source_parser.rb +18 -7
- data/lib/yard/rake/yardoc_task.rb +1 -1
- data/lib/yard/registry.rb +83 -29
- data/lib/yard/registry_store.rb +213 -0
- data/lib/yard/serializers/base.rb +1 -1
- data/lib/yard/serializers/yardoc_serializer.rb +113 -0
- data/lib/yard/tags/library.rb +4 -0
- data/lib/yard/tags/overload_tag.rb +16 -5
- data/lib/yard/tags/tag.rb +1 -2
- data/lib/yard/templates/engine.rb +3 -3
- data/lib/yard/templates/helpers/html_helper.rb +50 -16
- data/lib/yard/templates/helpers/html_syntax_highlight_helper.rb +1 -3
- data/lib/yard/templates/helpers/html_syntax_highlight_helper18.rb +1 -3
- data/lib/yard/templates/helpers/method_helper.rb +11 -4
- data/lib/yard/templates/helpers/text_helper.rb +24 -2
- data/lib/yard/verifier.rb +3 -3
- data/spec/cli/yardoc_spec.rb +33 -6
- data/spec/cli/yri_spec.rb +30 -0
- data/spec/code_objects/base_spec.rb +7 -0
- data/spec/code_objects/class_object_spec.rb +6 -1
- data/spec/code_objects/method_object_spec.rb +25 -0
- data/spec/core_ext/hash_spec.rb +10 -0
- data/spec/core_ext/module_spec.rb +1 -1
- data/spec/core_ext/string_spec.rb +50 -12
- data/spec/handlers/attribute_handler_spec.rb +4 -0
- data/spec/handlers/examples/method_handler_001.rb.txt +9 -0
- data/spec/handlers/method_handler_spec.rb +22 -4
- data/spec/parser/c_parser_spec.rb +22 -0
- data/spec/parser/examples/array.c.txt +3887 -0
- data/spec/parser/source_parser_spec.rb +29 -7
- data/spec/registry_spec.rb +93 -72
- data/spec/registry_store_spec.rb +184 -0
- data/spec/serializers/file_system_serializer_spec.rb +96 -75
- data/spec/spec_helper.rb +2 -2
- data/spec/tags/overload_tag_spec.rb +18 -0
- data/spec/templates/examples/class001.html +32 -30
- data/spec/templates/examples/method001.html +4 -1
- data/spec/templates/examples/method002.html +7 -2
- data/spec/templates/examples/method002.txt +1 -1
- data/spec/templates/examples/method003.html +30 -8
- data/spec/templates/examples/method003.txt +4 -4
- data/spec/templates/examples/method004.html +44 -0
- data/spec/templates/examples/method004.txt +10 -0
- data/spec/templates/examples/method005.html +99 -0
- data/spec/templates/examples/method005.txt +33 -0
- data/spec/templates/examples/module001.dot +1 -1
- data/spec/templates/examples/module001.html +391 -37
- data/spec/templates/examples/module001.txt +1 -1
- data/spec/templates/helpers/base_helper_spec.rb +2 -2
- data/spec/templates/helpers/html_helper_spec.rb +83 -0
- data/spec/templates/helpers/method_helper_spec.rb +47 -0
- data/spec/templates/helpers/shared_signature_examples.rb +102 -0
- data/spec/templates/helpers/text_helper_spec.rb +31 -0
- data/spec/templates/method_spec.rb +43 -18
- data/spec/templates/module_spec.rb +22 -1
- data/spec/templates/spec_helper.rb +10 -1
- data/spec/yard_spec.rb +4 -3
- data/templates/default/class/html/constructor_details.erb +1 -1
- data/templates/default/docstring/html/returns_void.erb +1 -0
- data/templates/default/docstring/setup.rb +9 -4
- data/templates/default/docstring/text/returns_void.erb +1 -0
- data/templates/default/fulldoc/html/css/style.css +4 -2
- data/templates/default/fulldoc/html/full_list.erb +2 -2
- data/templates/default/fulldoc/html/js/app.js +1 -1
- data/templates/default/fulldoc/html/setup.rb +14 -6
- data/templates/default/layout/dot/setup.rb +1 -1
- data/templates/default/layout/html/breadcrumb.erb +2 -2
- data/templates/default/layout/html/index.erb +2 -2
- data/templates/default/layout/html/setup.rb +5 -5
- data/templates/default/method/html/header.erb +6 -4
- data/templates/default/method_details/html/method_signature.erb +2 -1
- data/templates/default/method_details/html/source.erb +1 -1
- data/templates/default/method_details/setup.rb +2 -1
- data/templates/default/method_details/text/setup.rb +1 -1
- data/templates/default/module/html/attribute_details.erb +4 -4
- data/templates/default/module/html/attribute_summary.erb +3 -3
- data/templates/default/module/html/box_info.erb +2 -2
- data/templates/default/module/html/defines.erb +1 -1
- data/templates/default/module/html/inherited_constants.erb +1 -1
- data/templates/default/module/html/inherited_methods.erb +1 -1
- data/templates/default/module/html/item_summary.erb +13 -4
- data/templates/default/module/html/method_details_list.erb +5 -4
- data/templates/default/module/html/method_summary.erb +5 -4
- data/templates/default/module/html/methodmissing.erb +1 -1
- data/templates/default/module/setup.rb +14 -5
- data/templates/default/tags/html/overload.erb +3 -2
- data/templates/default/tags/setup.rb +4 -0
- metadata +23 -2
@@ -81,14 +81,14 @@ describe YARD::Templates::Helpers::BaseHelper do
|
|
81
81
|
describe '#format_object_type' do
|
82
82
|
it "should return Exception if type is Exception" do
|
83
83
|
obj = mock(:object)
|
84
|
-
obj.stub!(:
|
84
|
+
obj.stub!(:is_a?).with(YARD::CodeObjects::ClassObject).and_return(true)
|
85
85
|
obj.stub!(:is_exception?).and_return(true)
|
86
86
|
format_object_type(obj).should == "Exception"
|
87
87
|
end
|
88
88
|
|
89
89
|
it "should return Class if type is Class" do
|
90
90
|
obj = mock(:object)
|
91
|
-
obj.stub!(:
|
91
|
+
obj.stub!(:is_a?).with(YARD::CodeObjects::ClassObject).and_return(true)
|
92
92
|
obj.stub!(:is_exception?).and_return(false)
|
93
93
|
format_object_type(obj).should == "Class"
|
94
94
|
end
|
@@ -1,7 +1,9 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/../../spec_helper'
|
2
|
+
require File.dirname(__FILE__) + "/shared_signature_examples"
|
2
3
|
|
3
4
|
describe YARD::Templates::Helpers::HtmlHelper do
|
4
5
|
include YARD::Templates::Helpers::HtmlHelper
|
6
|
+
include YARD::Templates::Helpers::MethodHelper
|
5
7
|
|
6
8
|
describe '#h' do
|
7
9
|
it "should use #h to escape HTML" do
|
@@ -77,6 +79,25 @@ describe YARD::Templates::Helpers::HtmlHelper do
|
|
77
79
|
stub!(:serializer).and_return nil
|
78
80
|
link_object(CodeObjects::NamespaceObject.new(nil, :YARD), 'title').should == "title"
|
79
81
|
end
|
82
|
+
|
83
|
+
it "should link objects from overload tag" do
|
84
|
+
YARD.parse_string <<-'eof'
|
85
|
+
module Foo
|
86
|
+
class Bar; def a; end end
|
87
|
+
class Baz
|
88
|
+
# @overload a
|
89
|
+
def a; end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
eof
|
93
|
+
obj = Registry.at('Foo::Baz#a').tag(:overload)
|
94
|
+
foobar = Registry.at('Foo::Bar')
|
95
|
+
foobaz = Registry.at('Foo::Baz')
|
96
|
+
serializer = Serializers::FileSystemSerializer.new
|
97
|
+
stub!(:serializer).and_return(serializer)
|
98
|
+
stub!(:object).and_return(obj)
|
99
|
+
link_object("Bar#a").should =~ %r{href="Bar.html#a-instance_method"}
|
100
|
+
end
|
80
101
|
end
|
81
102
|
|
82
103
|
describe '#url_for' do
|
@@ -186,4 +207,66 @@ describe YARD::Templates::Helpers::HtmlHelper do
|
|
186
207
|
}
|
187
208
|
end
|
188
209
|
end
|
210
|
+
|
211
|
+
describe '#signature' do
|
212
|
+
before do
|
213
|
+
@results = {
|
214
|
+
:regular => "- (Object) <strong>foo</strong>",
|
215
|
+
:default_return => "- (Hello) <strong>foo</strong>",
|
216
|
+
:no_default_return => "- <strong>foo</strong>",
|
217
|
+
:private_class => "+ (Object) <strong>foo</strong> <span class=\"extras\">(private)</span>",
|
218
|
+
:single => "- (String) <strong>foo</strong>",
|
219
|
+
:two_types => "- (String, Symbol) <strong>foo</strong>",
|
220
|
+
:two_types_multitag => "- (String, Symbol) <strong>foo</strong>",
|
221
|
+
:type_nil => "- (Type<sup>?</sup>) <strong>foo</strong>",
|
222
|
+
:type_array => "- (Type<sup>+</sup>) <strong>foo</strong>",
|
223
|
+
:multitype => "- (Type, ...) <strong>foo</strong>",
|
224
|
+
:void => "- (void) <strong>foo</strong>",
|
225
|
+
:hide_void => "- <strong>foo</strong>",
|
226
|
+
:block => "- (Object) <strong>foo</strong> {|a, b, c| ... }"
|
227
|
+
}
|
228
|
+
end
|
229
|
+
|
230
|
+
def format_types(types, brackets = false) types.join(", ") end
|
231
|
+
def signature(obj) super(obj, false).strip end
|
232
|
+
|
233
|
+
it_should_behave_like "signature"
|
234
|
+
end
|
235
|
+
|
236
|
+
describe '#html_syntax_highlight' do
|
237
|
+
before do
|
238
|
+
stub!(:options).and_return(:no_highlight => false)
|
239
|
+
end
|
240
|
+
|
241
|
+
it "should return empty string on nil input" do
|
242
|
+
html_syntax_highlight(nil).should == ''
|
243
|
+
end
|
244
|
+
|
245
|
+
it "should call #html_syntax_highlight_ruby by default" do
|
246
|
+
should_receive(:html_syntax_highlight_ruby).with('def x; end')
|
247
|
+
html_syntax_highlight('def x; end')
|
248
|
+
end
|
249
|
+
|
250
|
+
it "should call html_syntax_highlight_NAME if source starts with !!!NAME" do
|
251
|
+
should_receive(:respond_to?).with('html_syntax_highlight_NAME').and_return(true)
|
252
|
+
should_receive(:html_syntax_highlight_NAME).and_return("foobar")
|
253
|
+
html_syntax_highlight(<<-eof
|
254
|
+
!!!NAME
|
255
|
+
def x; end
|
256
|
+
eof
|
257
|
+
).should == "foobar"
|
258
|
+
end
|
259
|
+
|
260
|
+
it "should not highlight if :no_highlight option is true" do
|
261
|
+
stub!(:options).and_return(:no_highlight => true)
|
262
|
+
should_not_receive(:html_syntax_highlight_ruby)
|
263
|
+
html_syntax_highlight('def x; end').should == 'def x; end'
|
264
|
+
end
|
265
|
+
|
266
|
+
it "should not highlight if there is no highlight method specified by !!!NAME" do
|
267
|
+
should_receive(:respond_to?).with('html_syntax_highlight_NAME').and_return(false)
|
268
|
+
should_not_receive(:html_syntax_highlight_NAME)
|
269
|
+
html_syntax_highlight("!!!NAME\ndef x; end").should == "def x; end"
|
270
|
+
end
|
271
|
+
end
|
189
272
|
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require File.dirname(__FILE__) + "/../spec_helper"
|
2
|
+
|
3
|
+
describe YARD::Templates::Helpers::MethodHelper do
|
4
|
+
include YARD::Templates::Helpers::BaseHelper
|
5
|
+
include YARD::Templates::Helpers::MethodHelper
|
6
|
+
|
7
|
+
describe '#format_block' do
|
8
|
+
before { YARD::Registry.clear }
|
9
|
+
|
10
|
+
it "should show block for method with yield" do
|
11
|
+
YARD.parse_string <<-'eof'
|
12
|
+
def foo; yield(a, b, c) end
|
13
|
+
eof
|
14
|
+
format_block(Registry.at('#foo')).should == "{|a, b, c| ... }"
|
15
|
+
end
|
16
|
+
|
17
|
+
it "should show block for method with @yieldparam tags" do
|
18
|
+
YARD.parse_string <<-'eof'
|
19
|
+
# @yieldparam _self me!
|
20
|
+
def foo; end
|
21
|
+
eof
|
22
|
+
format_block(Registry.at('#foo')).should == "{|_self| ... }"
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should show block for method with @yield but no types" do
|
26
|
+
YARD.parse_string <<-'eof'
|
27
|
+
# @yield blah
|
28
|
+
# @yieldparam a
|
29
|
+
def foo; end
|
30
|
+
|
31
|
+
# @yield blah
|
32
|
+
def foo2; end
|
33
|
+
eof
|
34
|
+
format_block(Registry.at('#foo')).should == "{|a| ... }"
|
35
|
+
format_block(Registry.at('#foo2')).should == "{ ... }"
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should show block for method with @yield and types" do
|
39
|
+
YARD.parse_string <<-'eof'
|
40
|
+
# @yield [a, b, c] blah
|
41
|
+
# @yieldparam a
|
42
|
+
def foo; end
|
43
|
+
eof
|
44
|
+
format_block(Registry.at('#foo')).should == "{|a, b, c| ... }"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,102 @@
|
|
1
|
+
shared_examples_for "signature" do
|
2
|
+
before do
|
3
|
+
YARD::Registry.clear
|
4
|
+
stub!(:options).and_return(:default_return => "Object")
|
5
|
+
end
|
6
|
+
|
7
|
+
it "should show signature for regular instance method" do
|
8
|
+
YARD.parse_string "def foo; end"
|
9
|
+
signature(Registry.at('#foo')).should == @results[:regular]
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should allow default return type to be changed" do
|
13
|
+
stub!(:options).and_return(:default_return => "Hello")
|
14
|
+
YARD.parse_string "def foo; end"
|
15
|
+
signature(Registry.at('#foo')).should == @results[:default_return]
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should allow default return type to be omitted" do
|
19
|
+
stub!(:options).and_return(:default_return => "")
|
20
|
+
YARD.parse_string "def foo; end"
|
21
|
+
signature(Registry.at('#foo')).should == @results[:no_default_return]
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should show signature for private class method" do
|
25
|
+
YARD.parse_string "class A; private; def self.foo; end end"
|
26
|
+
signature(Registry.at('A.foo')).should == @results[:private_class]
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should show return type for single type" do
|
30
|
+
YARD.parse_string <<-'eof'
|
31
|
+
# @return [String]
|
32
|
+
def foo; end
|
33
|
+
eof
|
34
|
+
signature(Registry.at('#foo')).should == @results[:single]
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should show return type for 2 types" do
|
38
|
+
YARD.parse_string <<-'eof'
|
39
|
+
# @return [String, Symbol]
|
40
|
+
def foo; end
|
41
|
+
eof
|
42
|
+
signature(Registry.at('#foo')).should == @results[:two_types]
|
43
|
+
end
|
44
|
+
|
45
|
+
it "should show return type for 2 types over multiple tags" do
|
46
|
+
YARD.parse_string <<-'eof'
|
47
|
+
# @return [String]
|
48
|
+
# @return [Symbol]
|
49
|
+
def foo; end
|
50
|
+
eof
|
51
|
+
signature(Registry.at('#foo')).should == @results[:two_types_multitag]
|
52
|
+
end
|
53
|
+
|
54
|
+
it "should show 'Type?' if return types are [Type, nil]" do
|
55
|
+
YARD.parse_string <<-'eof'
|
56
|
+
# @return [Type, nil]
|
57
|
+
def foo; end
|
58
|
+
eof
|
59
|
+
signature(Registry.at('#foo')).should == @results[:type_nil]
|
60
|
+
end
|
61
|
+
|
62
|
+
it "should show 'Type+' if return types are [Type, Array<Type>]" do
|
63
|
+
YARD.parse_string <<-'eof'
|
64
|
+
# @return [Type, <Type>]
|
65
|
+
def foo; end
|
66
|
+
eof
|
67
|
+
signature(Registry.at('#foo')).should == @results[:type_array]
|
68
|
+
end
|
69
|
+
|
70
|
+
it "should (Type, ...) for more than 2 return types" do
|
71
|
+
YARD.parse_string <<-'eof'
|
72
|
+
# @return [Type, <Type>]
|
73
|
+
# @return [AnotherType]
|
74
|
+
def foo; end
|
75
|
+
eof
|
76
|
+
signature(Registry.at('#foo')).should == @results[:multitype]
|
77
|
+
end
|
78
|
+
|
79
|
+
it "should show (void) for @return [void] by default" do
|
80
|
+
YARD.parse_string <<-'eof'
|
81
|
+
# @return [void]
|
82
|
+
def foo; end
|
83
|
+
eof
|
84
|
+
signature(Registry.at('#foo')).should == @results[:void]
|
85
|
+
end
|
86
|
+
|
87
|
+
it "should not show return for @return [void] if :hide_void_return is true" do
|
88
|
+
stub!(:options).and_return(:hide_void_return => true)
|
89
|
+
YARD.parse_string <<-'eof'
|
90
|
+
# @return [void]
|
91
|
+
def foo; end
|
92
|
+
eof
|
93
|
+
signature(Registry.at('#foo')).should == @results[:hide_void]
|
94
|
+
end
|
95
|
+
|
96
|
+
it "should show block for method with yield" do
|
97
|
+
YARD.parse_string <<-'eof'
|
98
|
+
def foo; yield(a, b, c) end
|
99
|
+
eof
|
100
|
+
signature(Registry.at('#foo')).should == @results[:block]
|
101
|
+
end
|
102
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../spec_helper'
|
2
|
+
require File.dirname(__FILE__) + "/shared_signature_examples"
|
3
|
+
|
4
|
+
describe YARD::Templates::Helpers::TextHelper do
|
5
|
+
include YARD::Templates::Helpers::TextHelper
|
6
|
+
include YARD::Templates::Helpers::MethodHelper
|
7
|
+
|
8
|
+
describe '#signature' do
|
9
|
+
before do
|
10
|
+
@results = {
|
11
|
+
:regular => "root.foo -> Object",
|
12
|
+
:default_return => "root.foo -> Hello",
|
13
|
+
:no_default_return => "root.foo",
|
14
|
+
:private_class => "A.foo -> Object (private)",
|
15
|
+
:single => "root.foo -> String",
|
16
|
+
:two_types => "root.foo -> (String, Symbol)",
|
17
|
+
:two_types_multitag => "root.foo -> (String, Symbol)",
|
18
|
+
:type_nil => "root.foo -> Type?",
|
19
|
+
:type_array => "root.foo -> Type+",
|
20
|
+
:multitype => "root.foo -> (Type, ...)",
|
21
|
+
:void => "root.foo -> void",
|
22
|
+
:hide_void => "root.foo",
|
23
|
+
:block => "root.foo {|a, b, c| ... } -> Object"
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
27
|
+
def signature(obj) super(obj).strip end
|
28
|
+
|
29
|
+
it_should_behave_like "signature"
|
30
|
+
end
|
31
|
+
end
|
@@ -1,10 +1,24 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/spec_helper'
|
2
2
|
|
3
|
+
# $COPY = :method001
|
4
|
+
# $COPYT = :html
|
5
|
+
|
3
6
|
describe YARD::Templates::Engine.template(:default, :method) do
|
4
7
|
before { Registry.clear }
|
5
8
|
|
9
|
+
shared_examples_for "all formats" do
|
10
|
+
it "should render html format correctly" do
|
11
|
+
html_equals(Registry.at('#m').format(:format => :html, :no_highlight => true), @template)
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should render text format correctly" do
|
15
|
+
text_equals(Registry.at('#m').format, @template)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
6
19
|
describe 'regular (deprecated) method' do
|
7
20
|
before do
|
21
|
+
@template = :method001
|
8
22
|
YARD.parse_string <<-'eof'
|
9
23
|
private
|
10
24
|
# Comments
|
@@ -17,17 +31,12 @@ describe YARD::Templates::Engine.template(:default, :method) do
|
|
17
31
|
eof
|
18
32
|
end
|
19
33
|
|
20
|
-
|
21
|
-
html_equals(Registry.at('#m').format(:format => :html, :no_highlight => true), :method001)
|
22
|
-
end
|
23
|
-
|
24
|
-
it "should render text format correctly" do
|
25
|
-
text_equals(Registry.at('#m').format, :method001)
|
26
|
-
end
|
34
|
+
it_should_behave_like "all formats"
|
27
35
|
end
|
28
36
|
|
29
37
|
describe 'method with 1 overload' do
|
30
38
|
before do
|
39
|
+
@template = :method002
|
31
40
|
YARD.parse_string <<-'eof'
|
32
41
|
private
|
33
42
|
# Comments
|
@@ -38,17 +47,12 @@ describe YARD::Templates::Engine.template(:default, :method) do
|
|
38
47
|
eof
|
39
48
|
end
|
40
49
|
|
41
|
-
|
42
|
-
html_equals(Registry.at('#m').format(:format => :html, :no_highlight => true), :method002)
|
43
|
-
end
|
44
|
-
|
45
|
-
it "should render text format correctly" do
|
46
|
-
text_equals(Registry.at('#m').format, :method002)
|
47
|
-
end
|
50
|
+
it_should_behave_like "all formats"
|
48
51
|
end
|
49
52
|
|
50
53
|
describe 'method with 2 overloads' do
|
51
54
|
before do
|
55
|
+
@template = :method003
|
52
56
|
YARD.parse_string <<-'eof'
|
53
57
|
private
|
54
58
|
# Method comments
|
@@ -64,12 +68,33 @@ describe YARD::Templates::Engine.template(:default, :method) do
|
|
64
68
|
eof
|
65
69
|
end
|
66
70
|
|
67
|
-
|
68
|
-
|
71
|
+
it_should_behave_like "all formats"
|
72
|
+
end
|
73
|
+
|
74
|
+
describe 'method void return' do
|
75
|
+
before do
|
76
|
+
@template = :method004
|
77
|
+
YARD.parse_string <<-'eof'
|
78
|
+
# @return [void]
|
79
|
+
def m(*args) end
|
80
|
+
eof
|
69
81
|
end
|
70
82
|
|
71
|
-
|
72
|
-
|
83
|
+
it_should_behave_like "all formats"
|
84
|
+
end
|
85
|
+
|
86
|
+
describe 'method void return in an overload' do
|
87
|
+
before do
|
88
|
+
@template = :method005
|
89
|
+
YARD.parse_string <<-'eof'
|
90
|
+
# @overload m(a)
|
91
|
+
# @return [void]
|
92
|
+
# @overload m(b)
|
93
|
+
# @param [String] b hi
|
94
|
+
def m(*args) end
|
95
|
+
eof
|
73
96
|
end
|
97
|
+
|
98
|
+
it_should_behave_like "all formats"
|
74
99
|
end
|
75
100
|
end
|
@@ -7,6 +7,8 @@ describe YARD::Templates::Engine.template(:default, :method) do
|
|
7
7
|
module B
|
8
8
|
def c; end
|
9
9
|
def d; end
|
10
|
+
private
|
11
|
+
def e; end
|
10
12
|
end
|
11
13
|
|
12
14
|
# Comments
|
@@ -14,9 +16,28 @@ describe YARD::Templates::Engine.template(:default, :method) do
|
|
14
16
|
attr_accessor :attr1
|
15
17
|
attr_reader :attr2
|
16
18
|
|
19
|
+
# @overload attr3
|
20
|
+
# @return [String] a string
|
21
|
+
# @overload attr3=(value)
|
22
|
+
# @param [String] value sets the string
|
23
|
+
# @return [void]
|
24
|
+
attr_accessor :attr3
|
25
|
+
|
17
26
|
def self.a; end
|
18
27
|
def a; end
|
19
28
|
alias b a
|
29
|
+
|
30
|
+
# @overload test_overload(a)
|
31
|
+
# hello2
|
32
|
+
# @param [String] a hi
|
33
|
+
def test_overload(*args) end
|
34
|
+
|
35
|
+
# @overload test_multi_overload(a)
|
36
|
+
# @overload test_multi_overload(a, b)
|
37
|
+
def test_multi_overload(*args) end
|
38
|
+
|
39
|
+
# @return [void]
|
40
|
+
def void_meth; end
|
20
41
|
|
21
42
|
include B
|
22
43
|
|
@@ -31,7 +52,7 @@ describe YARD::Templates::Engine.template(:default, :method) do
|
|
31
52
|
end
|
32
53
|
|
33
54
|
it "should render html format correctly" do
|
34
|
-
html_equals(Registry.at('A').format(:format => :html, :no_highlight => true), :module001)
|
55
|
+
html_equals(Registry.at('A').format(:format => :html, :no_highlight => true, :hide_void_return => true, :visibilities => [:public]), :module001)
|
35
56
|
end
|
36
57
|
|
37
58
|
it "should render text format correctly" do
|