summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/data/snippets/hash.pp33
-rwxr-xr-xtest/language/snippets.rb7
2 files changed, 40 insertions, 0 deletions
diff --git a/test/data/snippets/hash.pp b/test/data/snippets/hash.pp
new file mode 100644
index 000000000..d33249872
--- /dev/null
+++ b/test/data/snippets/hash.pp
@@ -0,0 +1,33 @@
+
+$hash = { "file" => "/tmp/myhashfile1" }
+
+file {
+ $hash["file"]:
+ ensure => file, content => "content";
+}
+
+$hash2 = { "a" => { key => "/tmp/myhashfile2" }}
+
+file {
+ $hash2["a"][key]:
+ ensure => file, content => "content";
+}
+
+define test($a = { "b" => "c" }) {
+ file {
+ $a["b"]:
+ ensure => file, content => "content"
+ }
+}
+
+test {
+ "test":
+ a => { "b" => "/tmp/myhashfile3" }
+}
+
+$hash3 = { mykey => "/tmp/myhashfile4" }
+$key = "mykey"
+
+file {
+ $hash3[$key]: ensure => file, content => "content"
+}
diff --git a/test/language/snippets.rb b/test/language/snippets.rb
index 5c7805c0a..bfd0e539c 100755
--- a/test/language/snippets.rb
+++ b/test/language/snippets.rb
@@ -486,6 +486,13 @@ class TestSnippets < Test::Unit::TestCase
assert_file("/tmp/testiftest","if test");
end
+ def snippet_hash
+ assert_file("/tmp/myhashfile1","hash test 1");
+ assert_file("/tmp/myhashfile2","hash test 2");
+ assert_file("/tmp/myhashfile3","hash test 3");
+ assert_file("/tmp/myhashfile4","hash test 4");
+ end
+
# Iterate across each of the snippets and create a test.
Dir.entries(snippetdir).sort.each { |file|
next if file =~ /^\./