diff options
Diffstat (limited to 'spec/integration/parser/compiler_spec.rb')
-rwxr-xr-x | spec/integration/parser/compiler_spec.rb | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/spec/integration/parser/compiler_spec.rb b/spec/integration/parser/compiler_spec.rb index 266347c60..df310ac07 100755 --- a/spec/integration/parser/compiler_spec.rb +++ b/spec/integration/parser/compiler_spec.rb @@ -81,9 +81,28 @@ describe Puppet::Parser::Compiler do Puppet::Parser::Compiler.compile(node).version.should == 2 end - it "should not allow classes inside conditional constructs" do + ['class', 'define', 'node'].each do |thing| + it "should not allow #{thing} inside evaluated conditional constructs" do + Puppet[:code] = <<-PP + if true { + #{thing} foo { + } + notify { decoy: } + } + PP + + begin + Puppet::Parser::Compiler.compile(Puppet::Node.new("mynode")) + raise "compilation should have raised Puppet::Error" + rescue Puppet::Error => e + e.message.should =~ /at line 2/ + end + end + end + + it "should not allow classes inside unevaluated conditional constructs" do Puppet[:code] = <<-PP - if true { + if false { class foo { } } |