summaryrefslogtreecommitdiffstats
path: root/spec/integration/parser/compiler_spec.rb
diff options
context:
space:
mode:
authorJesse Wolfe <jes5199@gmail.com>2010-09-09 16:29:26 -0700
committerJesse Wolfe <jes5199@gmail.com>2010-09-09 16:29:26 -0700
commit1d93c4dd86181eb2663dd8df2e84719c2e1ffcdf (patch)
treefc0e6feee2558d0a59e70c3f7e3b16dee72f0235 /spec/integration/parser/compiler_spec.rb
parent6860594c4d95855d5106fbf664a473e1ac4d3935 (diff)
parentce9bf1edcaac4901de6e0a7da413d1742d216eb0 (diff)
downloadpuppet-1d93c4dd86181eb2663dd8df2e84719c2e1ffcdf.tar.gz
puppet-1d93c4dd86181eb2663dd8df2e84719c2e1ffcdf.tar.xz
puppet-1d93c4dd86181eb2663dd8df2e84719c2e1ffcdf.zip
Merge remote branch 'paul/ticket/next/4685' into next
Conflicts resolved manually, by Paul Berry: lib/puppet/parser/ast/astarray.rb lib/puppet/parser/grammar.ra lib/puppet/parser/parser.rb (by rebuilding from grammar.ra)
Diffstat (limited to 'spec/integration/parser/compiler_spec.rb')
-rwxr-xr-xspec/integration/parser/compiler_spec.rb23
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 {
}
}