summaryrefslogtreecommitdiffstats
path: root/spec/unit/parser
diff options
context:
space:
mode:
authorBrice Figureau <brice-puppet@daysofwonder.com>2010-06-06 15:40:44 +0200
committertest branch <puppet-dev@googlegroups.com>2010-02-17 06:50:53 -0800
commitfb5c1d7bbe629df6214af9b47e522fb282983beb (patch)
treef3424800be3a174d351097061c0741b87ef21106 /spec/unit/parser
parent9592dd896c6aab9a3e9b0181c943e7c9ba3d2d6d (diff)
downloadpuppet-fb5c1d7bbe629df6214af9b47e522fb282983beb.tar.gz
puppet-fb5c1d7bbe629df6214af9b47e522fb282983beb.tar.xz
puppet-fb5c1d7bbe629df6214af9b47e522fb282983beb.zip
Fix #3907 - Hash couldn't be initialized with an empty hash
The following manifest was failing: $data = {} This patch makes sure we initalize our ast hash with an empty ruby hash when it is created without any values. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
Diffstat (limited to 'spec/unit/parser')
-rw-r--r--spec/unit/parser/ast/asthash.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/unit/parser/ast/asthash.rb b/spec/unit/parser/ast/asthash.rb
index c6839ab4d..fc8e1c7ea 100644
--- a/spec/unit/parser/ast/asthash.rb
+++ b/spec/unit/parser/ast/asthash.rb
@@ -78,6 +78,18 @@ describe Puppet::Parser::AST::ASTHash do
operator.evaluate(@scope).should == { key1 => "b", key2 => "d" }
end
+ describe "when being initialized without arguments" do
+ it "should evaluate to an empty hash" do
+ hash = Puppet::Parser::AST::ASTHash.new({})
+ hash.evaluate(@scope).should == {}
+ end
+
+ it "should support merging" do
+ hash = Puppet::Parser::AST::ASTHash.new({})
+ hash.merge({"a" => "b"}).should == {"a" => "b"}
+ end
+ end
+
it "should return a valid string with to_s" do
hash = Puppet::Parser::AST::ASTHash.new(:value => { "a" => "b", "c" => "d" })