Skip to content

Commit

Permalink
export, test, docs
Browse files Browse the repository at this point in the history
  • Loading branch information
aplavin committed Jan 5, 2024
1 parent b481860 commit 38921d7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/optics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ end
Elements
Access all elements of a collection that implements `map`.
An alias for `Elements()` is available as `∗` (`\\ast`). This optic can also be written as `@optic _[∗]`.
```jldoctest
julia> using Accessors
Expand Down Expand Up @@ -295,7 +296,8 @@ end
"""
Properties()
Access all properties of an objects.
Access all properties of an object.
An alias for `Properties()` is available as `∗ₚ` (`\\ast\\_p`). This optic can also be written as `@optic _[∗ₚ]`.
```jldoctest
julia> using Accessors
Expand Down
2 changes: 1 addition & 1 deletion src/sugar.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export @set, @optic, @o, @reset, @modify, @delete, @insert, @accessor
export @set, @optic, @o, @reset, @modify, @delete, @insert, @accessor, ,
using MacroTools

"""
Expand Down
6 changes: 6 additions & 0 deletions test/test_optics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,10 @@ end
@test Accessors.DynamicIndexLens(lastindex).([(1,2,3), (4,5)]) == [3, 5]
end

@testset "shortcuts" begin
@test (@o _.a[2]) === (@optic _.a[2])
@test (@optic _[]) === Elements()
@test (@optic _.a[][2]) === (@optic _.a |> Elements() |> _[2])
end

end#module

0 comments on commit 38921d7

Please sign in to comment.