From 323b00630a9f5f09d25d1af29b94c9e43ade6681 Mon Sep 17 00:00:00 2001 From: Alexander Plavin Date: Sun, 3 Mar 2024 11:15:31 -0500 Subject: [PATCH] tests: improvements --- test/perf.jl | 6 ++---- test/test_core.jl | 4 ---- test/test_functionlenses.jl | 8 ++++++++ 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/test/perf.jl b/test/perf.jl index 158d213d..4a2e2e97 100644 --- a/test/perf.jl +++ b/test/perf.jl @@ -177,16 +177,14 @@ 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 diff --git a/test/test_core.jl b/test/test_core.jl index 269b6a97..ce70ddaa 100644 --- a/test/test_core.jl +++ b/test/test_core.jl @@ -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 diff --git a/test/test_functionlenses.jl b/test/test_functionlenses.jl index ac6566a8..1052a322 100644 --- a/test/test_functionlenses.jl +++ b/test/test_functionlenses.jl @@ -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