Skip to content

Commit

Permalink
make Accessors.jl tests run
Browse files Browse the repository at this point in the history
  • Loading branch information
longemen3000 authored Sep 1, 2024
1 parent cd796cb commit 6d33c22
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion test/test_core.jl
Original file line number Diff line number Diff line change
Expand Up @@ -603,9 +603,13 @@ end
@accessor Base.Float64(s::MyStruct) = s.x[2]
@accessor (t::MyStruct)(s::MyStruct) = s.x + t.x

#https://github.com/JuliaLang/julia/issues/54664: the return type of @doc f changes depending on REPL being loaded.
__string(s) = string(s)
__string(s::Base.Docs.DocStr) = join(collect(x.text),'\n')

@testset "@accessor" begin
s = MyStruct((a=123,))
@test strip(string(@doc(my_x))) == "Documentation for my_x"
@test strip(__string(@doc(my_x))) == "Documentation for my_x"
@test (@set my_x(s) = 456) === MyStruct(456)
@test (@set +s = 456) === MyStruct((a=5-456,))
test_getset_laws(my_x, s, 456, "1")
Expand Down

0 comments on commit 6d33c22

Please sign in to comment.