summaryrefslogtreecommitdiffstats
path: root/spec/unit/util/rdoc
diff options
context:
space:
mode:
authorBrice Figureau <brice-puppet@daysofwonder.com>2009-11-04 20:21:16 +0100
committerBrice Figureau <brice-puppet@daysofwonder.com>2009-11-04 20:21:16 +0100
commitb832d815c3211f22945cbce56dfbf61116f7a792 (patch)
tree347076d81c5c5bd176b24a3bec4f83b452c80a63 /spec/unit/util/rdoc
parentb1deb89bae67f7d71ffe412ce4fd8e99c6e1c159 (diff)
downloadpuppet-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-xspec/unit/util/rdoc/parser.rb18
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