summaryrefslogtreecommitdiffstats
path: root/spec/unit/util
diff options
context:
space:
mode:
authorMarkus Roberts <Markus@reality.com>2011-02-01 16:22:06 -0800
committerMarkus Roberts <Markus@reality.com>2011-02-01 16:22:06 -0800
commitadb8c7994ea7d2d30aaea698fbe08727ed553fef (patch)
tree3f8f7b605dc9ad999409353266e7e3130667e697 /spec/unit/util
parent517c6794606e9adde7f2912d3b949cfcc18a446a (diff)
parent443eba9b7a85cffa6b8513a32a620c80917be768 (diff)
Merge branch '2.6.next' of git://github.com/puppetlabs/puppet into 2.6.next
Diffstat (limited to 'spec/unit/util')
-rwxr-xr-xspec/unit/util/zaml_spec.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/spec/unit/util/zaml_spec.rb b/spec/unit/util/zaml_spec.rb
index f2bcefe01..59590c571 100755
--- a/spec/unit/util/zaml_spec.rb
+++ b/spec/unit/util/zaml_spec.rb
@@ -35,5 +35,26 @@ describe "Pure ruby yaml implementation" do
lambda { YAML.load(o.to_yaml) }.should_not raise_error
end
}
+
+ it "should handle references to Array in Hash values correctly" do
+ list = [1]
+ data = { "one" => list, "two" => list }
+ data.to_yaml.should == "--- \n two: &id001 \n - 1\n one: *id001"
+ expect { YAML.load(data.to_yaml).should == data }.should_not raise_error
+ end
+
+ it "should handle references to Hash in Hash values correctly" do
+ hash = { 1 => 1 }
+ data = { "one" => hash, "two" => hash }
+ data.to_yaml.should == "--- \n two: &id001 \n 1: 1\n one: *id001"
+ expect { YAML.load(data.to_yaml).should == data }.should_not raise_error
+ end
+
+ it "should handle references to Scalar in Hash" do
+ str = "hello"
+ data = { "one" => str, "two" => str }
+ data.to_yaml.should == "--- \n two: &id001 hello\n one: *id001"
+ expect { YAML.load(data.to_yaml).should == data }.should_not raise_error
+ end
end