Skip to content

Commit

Permalink
tests: improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
aplavin committed Mar 3, 2024
1 parent abfc6da commit 1af9d61
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
5 changes: 2 additions & 3 deletions test/perf.jl
Original file line number Diff line number Diff line change
Expand Up @@ -177,16 +177,15 @@ end
println("Right associative composition: $b_right")

@test b_default.allocs == 0
if VERSION >= v"1.10-"
@test_broken b_right.allocs == 0
elseif VERSION >= v"1.7"
if VERSION >= v"1.7"
@test b_right.allocs == 0
else
@test_broken right.allocs == 0
@test b_right.time > 2b_default.time
end
@test b_left.allocs == 0
@test b_left.time b_default.time rtol=0.8
@test b_right.time b_default.time rtol=0.8
end

end
4 changes: 0 additions & 4 deletions test/test_core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -227,11 +227,7 @@ end
else
@inferred lens(obj)
@inferred set(obj, lens, val)
@test_broken begin
# https://github.com/JuliaLang/julia/issues/43296
@inferred modify(identity, obj, lens)
true
end
end
end
end
Expand Down
8 changes: 8 additions & 0 deletions test/test_functionlenses.jl
Original file line number Diff line number Diff line change
Expand Up @@ -391,4 +391,12 @@ end
test_getset_laws(o2, x, 2, -3)
end

@testset "non-callable" begin
struct MyF end
Accessors.set(x, ::MyF, y) = y + 1
Accessors.modify(f, x, ::MyF) = f(x)
@test set(1, (@o _ + 2 |> MyF()), 3) == 2
@test modify(x -> 10x, 1, (@o _ + 2 |> MyF())) == 28
end

end # module

0 comments on commit 1af9d61

Please sign in to comment.