summaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorBrice Figureau <brice-puppet@daysofwonder.com>2011-02-12 17:34:35 +0100
committerBrice Figureau <brice-puppet@daysofwonder.com>2011-02-12 17:34:35 +0100
commit414e3a5989c4c1010af0c5d3f61af2608d91d9b8 (patch)
tree0ac166a0cc6f225860f6e1e8e316f88f42cd4acb /spec
parent70a43c4b0d3018a39e29c50b1caf7dec38694323 (diff)
downloadpuppet-414e3a5989c4c1010af0c5d3f61af2608d91d9b8.tar.gz
puppet-414e3a5989c4c1010af0c5d3f61af2608d91d9b8.tar.xz
puppet-414e3a5989c4c1010af0c5d3f61af2608d91d9b8.zip
Fix #5516 - Hashes can't be used in selectors
The following manifest was producing a parse error: $int = { 'eth0' => 'bla' } $foo = $int['eth0'] ? { 'bla' => 'foo', default => 'bleh' } because selectors didn't support hash access. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
Diffstat (limited to 'spec')
-rwxr-xr-xspec/unit/parser/parser_spec.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/spec/unit/parser/parser_spec.rb b/spec/unit/parser/parser_spec.rb
index 07e2d220b..9e4c79588 100755
--- a/spec/unit/parser/parser_spec.rb
+++ b/spec/unit/parser/parser_spec.rb
@@ -76,6 +76,12 @@ describe Puppet::Parser do
end
+ describe "when parsing selector" do
+ it "should support hash access on the left hand side" do
+ lambda { @parser.parse("$h = { 'a' => 'b' } $a = $h['a'] ? { 'b' => 'd', default => undef }") }.should_not raise_error
+ end
+ end
+
describe "when parsing 'if'" do
it "not, it should create the correct ast objects" do
ast::Not.expects(:new).with { |h| h[:value].is_a?(ast::Boolean) }