summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJames Turnbull <james@lovedthanlost.net>2008-05-16 16:49:22 +1000
committerJames Turnbull <james@lovedthanlost.net>2008-05-16 16:50:29 +1000
commit38545d9a81274c16a43f7f19889cd12e52871d76 (patch)
tree8a28ab3f3535b8e234f3394f87ff99b1633f0705 /test
parent7897335318be2bb98187b570fb7c867ebe109c12 (diff)
downloadpuppet-38545d9a81274c16a43f7f19889cd12e52871d76.tar.gz
puppet-38545d9a81274c16a43f7f19889cd12e52871d76.tar.xz
puppet-38545d9a81274c16a43f7f19889cd12e52871d76.zip
Crontab provider: fix a parse error when a line begins with a space character
Tests for Bug #1216 Updated CHANGELOG
Diffstat (limited to 'test')
-rwxr-xr-xtest/ral/providers/cron/crontab.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/ral/providers/cron/crontab.rb b/test/ral/providers/cron/crontab.rb
index 53bd76c50..900a0478e 100755
--- a/test/ral/providers/cron/crontab.rb
+++ b/test/ral/providers/cron/crontab.rb
@@ -599,5 +599,33 @@ class TestCronParsedProvider < Test::Unit::TestCase
result = target.read
assert_equal("# Puppet Name: test\n* 4 * * * /bin/echo yay\n", result, "Did not write out environment setting")
end
+
+ # Testing #1216
+ def test_strange_lines
+ @provider.stubs(:filetype).returns(Puppet::Util::FileType.filetype(:ram))
+ text = " 5 \t\t 1,2 * 1 0 /bin/echo funtest"
+
+ records = nil
+ assert_nothing_raised {
+ records = @provider.parse(text)
+ }
+
+ should = {
+ :minute => %w{5},
+ :hour => %w{1 2},
+ :monthday => :absent,
+ :month => %w{1},
+ :weekday => %w{0},
+ :command => "/bin/echo funtest"
+ }
+
+ is = records.shift
+ assert(is, "Did not get record")
+
+ should.each do |p, v|
+ assert_equal(v, is[p], "did not parse %s correctly" % p)
+ end
+ end
+
end