summaryrefslogtreecommitdiffstats
path: root/spec/integration/parser/compiler_spec.rb
diff options
context:
space:
mode:
authorPaul Berry <paul@puppetlabs.com>2010-09-07 18:01:42 -0700
committerPaul Berry <paul@puppetlabs.com>2010-09-07 18:01:42 -0700
commitce9bf1edcaac4901de6e0a7da413d1742d216eb0 (patch)
treee0ec052bf1d6b33ec3d8a90970ba10206c06d53c /spec/integration/parser/compiler_spec.rb
parent25048ecc40db746f7e88bb6c5e1fc4f2c0150a4f (diff)
downloadpuppet-ce9bf1edcaac4901de6e0a7da413d1742d216eb0.tar.gz
puppet-ce9bf1edcaac4901de6e0a7da413d1742d216eb0.tar.xz
puppet-ce9bf1edcaac4901de6e0a7da413d1742d216eb0.zip
Modified the error message that is generated when a class, definition,
or node occurs in a conditional construct so that it contains the proper line number.
Diffstat (limited to 'spec/integration/parser/compiler_spec.rb')
-rwxr-xr-xspec/integration/parser/compiler_spec.rb22
1 files changed, 15 insertions, 7 deletions
diff --git a/spec/integration/parser/compiler_spec.rb b/spec/integration/parser/compiler_spec.rb
index ffff4d845..df310ac07 100755
--- a/spec/integration/parser/compiler_spec.rb
+++ b/spec/integration/parser/compiler_spec.rb
@@ -81,15 +81,23 @@ describe Puppet::Parser::Compiler do
Puppet::Parser::Compiler.compile(node).version.should == 2
end
- it "should not allow classes inside evaluated conditional constructs" do
- Puppet[:code] = <<-PP
- if true {
- class foo {
+ ['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
+ PP
- lambda { Puppet::Parser::Compiler.compile(Puppet::Node.new("mynode")) }.should raise_error(Puppet::Error)
+ 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