diff options
| author | Brice Figureau <brice-puppet@daysofwonder.com> | 2009-11-04 20:21:16 +0100 |
|---|---|---|
| committer | Brice Figureau <brice-puppet@daysofwonder.com> | 2009-11-04 20:21:16 +0100 |
| commit | b832d815c3211f22945cbce56dfbf61116f7a792 (patch) | |
| tree | 347076d81c5c5bd176b24a3bec4f83b452c80a63 /spec/unit/util/rdoc | |
| parent | b1deb89bae67f7d71ffe412ce4fd8e99c6e1c159 (diff) | |
| download | puppet-b832d815c3211f22945cbce56dfbf61116f7a792.tar.gz puppet-b832d815c3211f22945cbce56dfbf61116f7a792.tar.xz puppet-b832d815c3211f22945cbce56dfbf61116f7a792.zip | |
Fix #2784 - puppetdoc/rdoc didn't parse mono-instruction class content
class klass {
include a, b, c
}
wasn't producing any rdoc documentation.
We were thinking code was always embedded in an array which is not
the case for mono-instruction code.
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
Diffstat (limited to 'spec/unit/util/rdoc')
| -rwxr-xr-x | spec/unit/util/rdoc/parser.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/unit/util/rdoc/parser.rb b/spec/unit/util/rdoc/parser.rb index b05df6da0..de11832b2 100755 --- a/spec/unit/util/rdoc/parser.rb +++ b/spec/unit/util/rdoc/parser.rb @@ -321,6 +321,12 @@ describe RDoc::Parser do @code.stubs(:is_a?).with(Puppet::Parser::AST::ASTArray).returns(true) end + it "should also scan mono-instruction code" do + @class.expects(:add_include).with { |i| i.is_a?(RDoc::Include) and i.name == "myclass" and i.comment == "mydoc" } + + @parser.scan_for_include_or_require(@class,create_stmt("include")) + end + it "should register recursively includes to the current container" do @code.stubs(:children).returns([ create_stmt("include") ]) @@ -354,6 +360,12 @@ describe RDoc::Parser do @class.expects(:add_constant).with { |i| i.is_a?(RDoc::Constant) and i.name == "myvar" and i.comment == "mydoc" } @parser.scan_for_vardef(@class, [ @code ]) end + + it "should also scan mono-instruction code" do + @class.expects(:add_constant).with { |i| i.is_a?(RDoc::Constant) and i.name == "myvar" and i.comment == "mydoc" } + + @parser.scan_for_vardef(@class, @stmt) + end end describe "when scanning for resources" do @@ -375,6 +387,12 @@ describe RDoc::Parser do @class.expects(:add_resource).with { |i| i.is_a?(RDoc::PuppetResource) and i.title == "myfile" and i.comment == "mydoc" } @parser.scan_for_resource(@class, [ @code ]) end + + it "should also scan mono-instruction code" do + @class.expects(:add_resource).with { |i| i.is_a?(RDoc::PuppetResource) and i.title == "myfile" and i.comment == "mydoc" } + + @parser.scan_for_resource(@class, @stmt) + end end describe "when parsing plugins" do |
