Write Cache to disk if an exception occurs while processing the Environment - fix #4

This commit is contained in:
josh committed 2014-04-15 14:20:30 -04:00
1 parent ea30b0b5ee
commit ee5aca275d
2 files changed
+36 -19

No files matched your search

+15
View File
@@ -176,6 +176,21 @@ module Rscons
expect { env.process }.to raise_error BuildError, /Failed.to.build.main.o/
end
it "writes the cache when the Builder raises an exception" do
env = Environment.new
env.Object("module.o", "module.c")
cache = "cache"
Cache.should_receive(:instance).and_return(cache)
cache.should_receive(:clear_checksum_cache!)
env.stub(:run_builder) do |builder, target, sources, cache, vars|
raise "Ruby exception thrown by builder"
end
cache.should_receive(:write)
expect { env.process }.to raise_error RuntimeError, /Ruby exception thrown by builder/
end
end
describe "#clear_targets" do