diff options
| author | Brice Figureau <brice-puppet@daysofwonder.com> | 2008-10-16 22:02:37 +0200 |
|---|---|---|
| committer | James Turnbull <james@lovedthanlost.net> | 2008-10-21 21:15:53 +1100 |
| commit | 6d05cbc1e1a22d4316e18fb22d5cff9c7a42d3cf (patch) | |
| tree | f0e7be01442451f10574e9499268c2012be81988 /test | |
| parent | ec2b4619d3c90b09e1b9fda0020552d5a2d6061f (diff) | |
| download | puppet-6d05cbc1e1a22d4316e18fb22d5cff9c7a42d3cf.tar.gz puppet-6d05cbc1e1a22d4316e18fb22d5cff9c7a42d3cf.tar.xz puppet-6d05cbc1e1a22d4316e18fb22d5cff9c7a42d3cf.zip | |
Fix #936 - Allow trailing comma in array definition
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
Diffstat (limited to 'test')
| -rw-r--r-- | test/data/snippets/arraytrailingcomma.pp | 3 | ||||
| -rwxr-xr-x | test/language/parser.rb | 13 | ||||
| -rwxr-xr-x | test/language/snippets.rb | 7 |
3 files changed, 23 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/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 5ea436d40..ebc977388 100755 --- a/test/language/snippets.rb +++ b/test/language/snippets.rb @@ -453,6 +453,13 @@ class TestSnippets < Test::Unit::TestCase "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 =~ /^\./ |
