Skip to content

Commit

Permalink
Adapt alias macro docstring test to nightly changes (#1807)
Browse files Browse the repository at this point in the history
  • Loading branch information
lgoettgens authored Sep 20, 2024
1 parent 804ca0d commit a37673c
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 16 deletions.
27 changes: 19 additions & 8 deletions test/AliasMacro-test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,23 @@ end
@test !(:isbar in names(Bla))

# verify docstring is correctly attached
@test string(@doc Bla.isfoo) ==
"""
```
isfoo
```
Alias for `is_foo`.
"""
if VERSION >= v"1.12.0-DEV.1223"
@test string(@doc Bla.isfoo) ==
"""
```julia
isfoo
```
Alias for `is_foo`.
"""
else
@test string(@doc Bla.isfoo) ==
"""
```
isfoo
```
Alias for `is_foo`.
"""
end
end
29 changes: 21 additions & 8 deletions test/Attributes-test.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
using REPL # needed due to https://github.com/JuliaLang/julia/issues/53349

module Tmp
using AbstractAlgebra

Expand Down Expand Up @@ -210,14 +212,25 @@ my_derived_type(::Type{Tmp.Container{T}}) where T = T
@test y === x

# verify docstring is correctly attached
@test string(@doc cached_attr) ==
"""
```
cached_attr(obj::T) where T
```
A cached attribute.
"""
if VERSION >= v"1.12.0-DEV.1223"
@test string(@doc cached_attr) ==
"""
```julia
cached_attr(obj::T) where T
```
A cached attribute.
"""
else
@test string(@doc cached_attr) ==
"""
```
cached_attr(obj::T) where T
```
A cached attribute.
"""
end

# test function location is tracked accurately (this requires that the
# definition of uncached_attr is before that of cached_attr)
Expand Down

0 comments on commit a37673c

Please # to comment.