Skip to content

Commit 28ba71c

Browse files
committed
test modify
1 parent 68567fd commit 28ba71c

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

test/test_queries.jl

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,23 @@ println("set")
2626
Accessors.set(obj, lens, vals) ==
2727
(7, (a=1.0, b=2.0f0), ("3", 4, 5.0), (x=2.0,), [1])
2828

29-
# using ProfileView
30-
# @profview for i in 1:1000000 Accessors.set(obj, lens, vals) end
29+
using ProfileView
30+
@profview for i in 1:1000000 Accessors.set(obj, lens, vals) end
3131

3232
println("unstable set")
3333
unstable_lens = Accessors.Query(select=x -> x isa Float64 && x > 2, descend=x -> x isa NamedTuple)
3434
@btime Accessors.set($obj, $unstable_lens, $vals)
3535
# slow_unstable_lens = Accessors.Query(; select=x -> x isa Number && x > 4, optic=Properties())
3636
# @btime Accessors.set($obj, $slow_unstable_lens, $vals))
37+
38+
# Somehow modify compiles away almost completely
39+
@btime modify(x -> 10x, $obj, $lens)
40+
@test modify(x -> 10x, obj, lens) == (7, (a=170.0, b=2.0f0), ("3", 4, 5.0), (x=60.0,), [1])
41+
using ProfileView
42+
@profview for i in 1:1000000 modify(x -> 10x, obj, lens) end
43+
44+
45+
obj = (1,2,3,4,5,6);
46+
47+
@macroexpand
48+
@set obj |> Properties() |> If(iseven)

0 commit comments

Comments
 (0)