Skip to content

Commit

Permalink
add feature to regression testing script
Browse files Browse the repository at this point in the history
  • Loading branch information
bjarthur committed Sep 8, 2018
1 parent 2e0d0da commit 4f6b21d
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions test/compare_examples.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ s = ArgParseSettings()
help = "print to STDOUT the output of `diff`"
action = :store_true
"--two"
help = "open and display both files"
help = "display both files"
action = :store_true
"--bw"
help = "generate, save and display a B&W difference image for PNG and SVG files. requires Rsvg, Cairo, and Images"
Expand Down Expand Up @@ -53,6 +53,11 @@ for i in 1:length(status)
end
end

function display_two(master,devel)
open_file(master)
open_file(devel)
end

# Compare with cached output
masterout = joinpath((@__DIR__), "master-output")
develout = joinpath((@__DIR__), "devel-output")
Expand Down Expand Up @@ -97,10 +102,7 @@ for file in intersect(master_files,devel_files)
diffcmd = `diff $(joinpath(masterout, file)) $(joinpath(develout, file))`
run(ignorestatus(diffcmd))
end
if args["two"]
open_file("$(joinpath(masterout,file))")
open_file("$(joinpath(develout,file))")
end
args["two"] && display_two(joinpath(masterout,file), joinpath(develout,file))
if args["bw"] && (endswith(file,".svg") || endswith(file,".png"))
wait_for_user = false
if endswith(file,".svg")
Expand All @@ -125,9 +127,14 @@ for file in intersect(master_files,devel_files)
println("PNGs are different sizes :(")
end
end
args["diff"] || args["two"] || (args["bw"] && wait_for_user) || continue
println("Press ENTER to continue, CTRL-C to quit")
readline()
args["diff"] || args["two"] || (args["bw"] &&
(endswith(file,".svg") || endswith(file,".png")) && wait_for_user) || continue
println("Enter 'two' to display both files, nothing to continue, or press CTRL-C to quit")
while true
resp = readline()
resp=="" && break
resp=="two" && display_two(joinpath(masterout,file), joinpath(develout,file))
end
end
end

Expand Down

0 comments on commit 4f6b21d

Please sign in to comment.