Skip to content

Commit

Permalink
Replaced eval by function calls
Browse files Browse the repository at this point in the history
  • Loading branch information
briederer committed Sep 17, 2021
1 parent a4b339b commit 59e5215
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions test/test_axes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -90,31 +90,31 @@ end
end

@testset "aliases" begin
compare(p::Plots.Plot, s::Symbol, val, op::Symbol) =
eval(Expr(:comparison, Meta.quot(p[1][:xaxis][s]), op, Meta.quot(p[1][:yaxis][s]), op, Meta.quot(p[1][:zaxis][s]), op, Meta.quot(val)))
compare(p::Plots.Plot, s::Symbol, val, op) =
op(p[1][:xaxis][s], val) && op(p[1][:yaxis][s], val) && op(p[1][:zaxis][s], val)
p = plot(1:2, guide = "all labels")
@test compare(p, :guide, "all labels", :(===))
@test compare(p, :guide, "all labels", ===)
p = plot(1:2, label = "test")
@test compare(p, :guide, "", :(===))
@test compare(p, :guide, "", ===)
p = plot(1:2, lim = (0, 3))
@test xlims(p) === ylims(p) === zlims(p) === (0,3)
p = plot(1:2, tick = [1.25, 1.5, 1.75])
@test compare(p,:ticks,[1.25, 1.5, 1.75], :(==))
@test compare(p,:ticks,[1.25, 1.5, 1.75], ==)
p = plot(1:2, labelfontsize = 4)
@test compare(p,:guidefontsize,4, :(==))
@test compare(p,:guidefontsize,4, ==)
p = plot(1:2, gα = .07)
@test compare(p,:gridalpha,.07, :())
@test compare(p,:gridalpha,.07, )
p = plot(1:2, gridls = :dashdot)
@test compare(p,:gridstyle,:dashdot, :(===))
@test compare(p,:gridstyle,:dashdot, ===)
p = plot(1:2, gridcolor = :red)
@test compare(p,:foreground_color_grid,RGBA{Float64}(1.,0.,0.,1.), :(===))
@test compare(p,:foreground_color_grid,RGBA{Float64}(1.,0.,0.,1.), ===)
p = plot(1:2, minorgridcolor = :red)
@test compare(p,:foreground_color_minor_grid,RGBA{Float64}(1.,0.,0.,1.), :(===))
@test compare(p,:foreground_color_minor_grid,RGBA{Float64}(1.,0.,0.,1.), ===)
p = plot(1:2, grid_lw = .01)
@test compare(p,:gridlinewidth,.01, :())
@test compare(p,:gridlinewidth,.01, )
p = plot(1:2, minorgrid_lw = .01)
@test compare(p,:minorgridlinewidth,.01, :())
@test compare(p,:minorgridlinewidth,.01, )
p = plot(1:2, tickor = :out)
@test compare(p,:tick_direction,:out, :(===))
@test compare(p,:tick_direction,:out, ===)

end

0 comments on commit 59e5215

Please sign in to comment.