Skip to content

Commit

Permalink
lo-level tests: factor index computation out for easier debugging (#35)
Browse files Browse the repository at this point in the history
  • Loading branch information
StefanKarpinski authored Mar 19, 2020
1 parent 263f606 commit b31defd
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,16 @@ const FORMATS = sort!(collect(keys(BSDiff.FORMATS)))
end
@testset "low-level API" begin
# test that diff is identical to reference diff
index = BSDiff.generate_index(old_data)
diff = sprint() do io
patch = BSDiff.EndsleyPatch(io, length(new_data))
BSDiff.generate_patch(patch, old_data, new_data)
BSDiff.generate_patch(patch, old_data, new_data, index)
end |> codeunits
@test read(ref) == diff
# test that applying reference patch to old produces new
new_data′ = open(ref) do io
patch = BSDiff.EndsleyPatch(io, length(new_data))
sprint() do new_io
patch = BSDiff.EndsleyPatch(io, length(new_data))
BSDiff.apply_patch(patch, old_data, new_io)
end |> codeunits
end
Expand Down

0 comments on commit b31defd

Please sign in to comment.