Skip to content

Commit

Permalink
Added tests for output file hashes
Browse files Browse the repository at this point in the history
  • Loading branch information
ralsina committed Jun 20, 2023
1 parent 1584f95 commit 2461fa4
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
18 changes: 16 additions & 2 deletions spec/croupier_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,6 @@ describe "Task" do

it "should fail if a no_save task doesn't generate the output when called" do
with_scenario("empty") do
File.delete?("output2") # Make sure this doesn't exist
TaskManager.cleanup
b = TaskProc.new {
""
}
Expand All @@ -226,6 +224,22 @@ describe "Task" do
end
end
end

it "should record hash for outputs in the TaskManager" do
with_scenario("empty") do
t = Task.new(
"name",
"output2",
[] of String,
TaskProc.new {
"sarasa"
},
)
t.run
TaskManager.next_run["output2"].should eq \
"609df08764e873e6f090a0064b38b2c5422cdf87"
end
end
end

describe "stale?" do
Expand Down
Empty file removed spec/files/.keep
Empty file.
1 change: 0 additions & 1 deletion src/croupier.cr
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ module Croupier
Dir.mkdir_p(File.dirname output)
File.open(output, "w") do |io|
io << data[i]
# FIXME add tests for this
TaskManager.next_run[output] = Digest::SHA1.hexdigest(data[i].to_s)
end
end
Expand Down

0 comments on commit 2461fa4

Please sign in to comment.