summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-10-21 19:28:21 +0200
committerLuke Kanies <luke@madstop.com>2008-10-21 19:28:21 +0200
commitb7d72360f66e36d897cfd4436236a3607a6de5b7 (patch)
treef0e7be01442451f10574e9499268c2012be81988 /test
parentfe789798cc0ccdc54b3a28d48bf206c9fc187085 (diff)
parent6d05cbc1e1a22d4316e18fb22d5cff9c7a42d3cf (diff)
Merge branch '0.24.x' of git://github.com/jamtur01/puppet into 0.24.x
Diffstat (limited to 'test')
-rw-r--r--test/data/snippets/arraytrailingcomma.pp3
-rw-r--r--test/data/snippets/funccomma.pp5
-rwxr-xr-xtest/language/parser.rb13
-rwxr-xr-xtest/language/snippets.rb14
4 files changed, 35 insertions, 0 deletions
diff --git a/test/data/snippets/arraytrailingcomma.pp b/test/data/snippets/arraytrailingcomma.pp
new file mode 100644
index 000000000..a410f9553
--- /dev/null
+++ b/test/data/snippets/arraytrailingcomma.pp
@@ -0,0 +1,3 @@
+file {
+ ["/tmp/arraytrailingcomma1","/tmp/arraytrailingcomma2", ]: content => "tmp"
+}
diff --git a/test/data/snippets/funccomma.pp b/test/data/snippets/funccomma.pp
new file mode 100644
index 000000000..32e34f92e
--- /dev/null
+++ b/test/data/snippets/funccomma.pp
@@ -0,0 +1,5 @@
+@file {
+ ["/tmp/funccomma1","/tmp/funccomma2"]: content => "1"
+}
+
+realize( File["/tmp/funccomma1"], File["/tmp/funccomma2"] , )
diff --git a/test/language/parser.rb b/test/language/parser.rb
index fc8452b87..2453bdf3c 100755
--- a/test/language/parser.rb
+++ b/test/language/parser.rb
@@ -66,6 +66,19 @@ class TestParser < Test::Unit::TestCase
}
end
+ def test_arrayrvalueswithtrailingcomma
+ parser = mkparser
+ ret = nil
+ file = tempfile()
+ assert_nothing_raised {
+ parser.string = "file { \"#{file}\": mode => [755, 640,] }"
+ }
+
+ assert_nothing_raised {
+ ret = parser.parse
+ }
+ end
+
def mkmanifest(file)
name = File.join(tmpdir, "file%s" % rand(100))
@@tmpfiles << name
diff --git a/test/language/snippets.rb b/test/language/snippets.rb
index 982ddfec4..ebc977388 100755
--- a/test/language/snippets.rb
+++ b/test/language/snippets.rb
@@ -446,6 +446,20 @@ class TestSnippets < Test::Unit::TestCase
"Did not make second file from duplicate subclass names")
end
+ def snippet_funccomma
+ assert_file("/tmp/funccomma1",
+ "Did not make first file from trailing function comma")
+ assert_file("/tmp/funccomma2",
+ "Did not make second file from trailing function comma")
+ end
+
+ def snippet_arraytrailingcomma
+ assert_file("/tmp/arraytrailingcomma1",
+ "Did not make first file from array")
+ assert_file("/tmp/arraytrailingcomma2",
+ "Did not make second file from array")
+ end
+
# Iterate across each of the snippets and create a test.
Dir.entries(snippetdir).sort.each { |file|
next if file =~ /^\./