summaryrefslogtreecommitdiffstats
path: root/spec/unit/parser
diff options
context:
space:
mode:
authorDaniel Pittman <daniel@puppetlabs.com>2011-02-12 11:36:29 -0800
committerDaniel Pittman <daniel@rimspace.net>2011-02-12 11:36:29 -0800
commit1abfd9c2e550be8cebdd94629d0f9759f14f7f34 (patch)
tree335f741f8b612e8be7c9634350f9a085c6862ab4 /spec/unit/parser
parent781601f8e7a9c6aecc5c9de66b1597b1879450d2 (diff)
parentb4a171e78c501208798220910352943331ceb9e0 (diff)
downloadpuppet-1abfd9c2e550be8cebdd94629d0f9759f14f7f34.tar.gz
puppet-1abfd9c2e550be8cebdd94629d0f9759f14f7f34.tar.xz
puppet-1abfd9c2e550be8cebdd94629d0f9759f14f7f34.zip
Merge branch 'masterzen/tickets/2.6/5720' into bug/2.6.next/5720-puppetdoc-fails-on-parameterized-class
Diffstat (limited to 'spec/unit/parser')
-rwxr-xr-xspec/unit/parser/lexer_spec.rb16
-rwxr-xr-xspec/unit/parser/parser_spec.rb27
2 files changed, 43 insertions, 0 deletions
diff --git a/spec/unit/parser/lexer_spec.rb b/spec/unit/parser/lexer_spec.rb
index 860326973..4ef242cf5 100755
--- a/spec/unit/parser/lexer_spec.rb
+++ b/spec/unit/parser/lexer_spec.rb
@@ -529,6 +529,22 @@ describe Puppet::Parser::Lexer, "when lexing comments" do
@lexer.fullscan
end
+ it "should add a new comment stack level on LPAREN" do
+ @lexer.string = "("
+
+ @lexer.expects(:commentpush)
+
+ @lexer.fullscan
+ end
+
+ it "should pop the current comment on RPAREN" do
+ @lexer.string = ")"
+
+ @lexer.expects(:commentpop)
+
+ @lexer.fullscan
+ end
+
it "should return the current comments on getcomment" do
@lexer.string = "# comment"
@lexer.fullscan
diff --git a/spec/unit/parser/parser_spec.rb b/spec/unit/parser/parser_spec.rb
index 07e2d220b..9aab6a716 100755
--- a/spec/unit/parser/parser_spec.rb
+++ b/spec/unit/parser/parser_spec.rb
@@ -304,6 +304,33 @@ describe Puppet::Parser do
it "should return an array of nodes" do
@parser.newnode(@nodename).should be_instance_of(Array)
end
+
+ it "should initialize the ast context with the correct line number" do
+ @parser.expects(:ast_context).with { |a,b| b == 123 }.returns({})
+ @parser.newnode(@nodename, { :line => 123 })
+ end
+ end
+
+ %w{class define}.each do |entity|
+ describe "when creating a #{entity}" do
+ before :each do
+ @parser.stubs(:ast_context).returns({})
+
+ @name = stub "#{entity}name", :is_a? => false, :value => "foo"
+ end
+
+ it "should create and add the correct resource type" do
+ instance = stub 'instance'
+ Puppet::Resource::Type.expects(:new).returns(instance)
+ @parser.known_resource_types.expects(:add).with(instance)
+ @parser.send("new#{entity}", @name)
+ end
+
+ it "should initialize the ast context with the correct line number" do
+ @parser.expects(:ast_context).with { |a,b| b == 123 }.returns({})
+ @parser.send("new#{entity}", @name, { :line => 123 })
+ end
+ end
end
describe "when retrieving a specific node" do