regression test for corrupted marshal file

This commit is contained in:
Florian Weingarten 2015-05-19 20:00:50 +00:00
parent 376c87b62e
commit 87400f2155
1 changed files with 10 additions and 0 deletions

View File

@ -144,6 +144,16 @@ class TestRegenerator < JekyllUnitTest
assert_equal File.mtime(@path), @regenerator.metadata[@path]["mtime"] assert_equal File.mtime(@path), @regenerator.metadata[@path]["mtime"]
end end
should "not crash when reading corrupted marshal file" do
metadata_file = source_dir(".jekyll-metadata")
File.open(metadata_file, "w") do |file|
file.puts Marshal.dump({ foo: 'bar' })[0,5]
end
@regenerator = Regenerator.new(@site)
assert_equal({}, @regenerator.metadata)
end
# Methods # Methods
should "be able to add a path to the metadata" do should "be able to add a path to the metadata" do