From c373b6272ddd4daabf15d1b459ef3e86072e3f26 Mon Sep 17 00:00:00 2001 From: Brice Figureau Date: Sat, 12 Feb 2011 16:58:20 +0100 Subject: Fix #6269 - Hashes only work with two levels of access The following manifest was failing: $hash = { 'a' => { 'b' => { 'c' => 'it works' } } } $out = $hash['a']['b']['c'] because of a typo in the grammar. Signed-off-by: Brice Figureau --- spec/integration/parser/parser_spec.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'spec/integration/parser') diff --git a/spec/integration/parser/parser_spec.rb b/spec/integration/parser/parser_spec.rb index 7b85bcacb..20d87c228 100755 --- a/spec/integration/parser/parser_spec.rb +++ b/spec/integration/parser/parser_spec.rb @@ -109,5 +109,12 @@ describe Puppet::Parser::Parser do it "should correctly set the arrow type of a relationship" do "Notify[foo] <~ Notify[bar]".should parse_with { |rel| rel.arrow == "<~" } end + + it "should be able to parse deep hash access" do + %q{ + $hash = { 'a' => { 'b' => { 'c' => 'it works' } } } + $out = $hash['a']['b']['c'] + }.should parse_with { |v| v.value.is_a?(Puppet::Parser::AST::ASTHash) } + end end end -- cgit From e3c59df2b246fe5e764272f21b631a5d2f28687f Mon Sep 17 00:00:00 2001 From: Nick Lewis Date: Thu, 17 Feb 2011 13:52:40 -0800 Subject: (#5935) Allow functions to accept negated values function(-1) was failing because the grammar wasn't allowing negated values in function calls. This fix makes the negation of any value which was previously legal as a function argument also now legal as a function argument. Paired-With: Max Martin Paired-With: Markus Roberts --- spec/integration/parser/parser_spec.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'spec/integration/parser') diff --git a/spec/integration/parser/parser_spec.rb b/spec/integration/parser/parser_spec.rb index 20d87c228..000e68dd8 100755 --- a/spec/integration/parser/parser_spec.rb +++ b/spec/integration/parser/parser_spec.rb @@ -116,5 +116,18 @@ describe Puppet::Parser::Parser do $out = $hash['a']['b']['c'] }.should parse_with { |v| v.value.is_a?(Puppet::Parser::AST::ASTHash) } end + + it "should be able to pass numbers to functions" do + %q{ + my_function(1) + }.should parse_as(Puppet::Parser::AST::Function) + end + + it "should be able to pass negative numbers to functions" do + %q{ + my_function(-1) + }.should parse_as(Puppet::Parser::AST::Function) + end + end end -- cgit From 2ecf91367c911a87dc5680108222dcc48ecca888 Mon Sep 17 00:00:00 2001 From: Nick Lewis Date: Mon, 21 Feb 2011 09:39:19 -0800 Subject: Revert "(#5935) Allow functions to accept negated values" This reverts commit e3c59df2b246fe5e764272f21b631a5d2f28687f. This commit is being reverted because the solution is incomplete, and a better solution is out of scope for this release. A more complete solution will be implemented in the future. --- spec/integration/parser/parser_spec.rb | 13 ------------- 1 file changed, 13 deletions(-) (limited to 'spec/integration/parser') diff --git a/spec/integration/parser/parser_spec.rb b/spec/integration/parser/parser_spec.rb index 000e68dd8..20d87c228 100755 --- a/spec/integration/parser/parser_spec.rb +++ b/spec/integration/parser/parser_spec.rb @@ -116,18 +116,5 @@ describe Puppet::Parser::Parser do $out = $hash['a']['b']['c'] }.should parse_with { |v| v.value.is_a?(Puppet::Parser::AST::ASTHash) } end - - it "should be able to pass numbers to functions" do - %q{ - my_function(1) - }.should parse_as(Puppet::Parser::AST::Function) - end - - it "should be able to pass negative numbers to functions" do - %q{ - my_function(-1) - }.should parse_as(Puppet::Parser::AST::Function) - end - end end -- cgit