Skip to content

Commit 4a2595a

Browse files
Add tests for generated function signatures fix.
1 parent 5415bce commit 4a2595a

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

test/TestModule/M.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ h_2(x::A{Int}) = x
1515
h_3(x::A{T}) where {T} = x
1616
h_4(x, ::Int, z) = x
1717

18+
@generated g_1(x) = x
19+
@generated g_2(x::Integer) = x
20+
1821
i_1(x; y = x) = x * y
1922
i_2(x::Int; y = x) = x * y
2023
i_3(x::T; y = x) where {T} = x * y

test/tests.jl

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,17 @@ end
166166
@test occursin("\ng(x, y, z; kwargs...)\n", str)
167167
@test occursin("\n```\n", str)
168168

169+
doc.data = Dict(
170+
:binding => Docs.Binding(M, :g_1),
171+
:typesig => Tuple{Any},
172+
:module => M,
173+
)
174+
DSE.format(SIGNATURES, buf, doc)
175+
str = String(take!(buf))
176+
@test occursin("\n```julia\n", str)
177+
@test occursin("\ng_1(x)\n", str)
178+
@test occursin("\n```\n", str)
179+
169180
doc.data = Dict(
170181
:binding => Docs.Binding(M, :h_4),
171182
:typesig => Union{Tuple{Any, Int, Any}},
@@ -196,6 +207,16 @@ end
196207
end
197208
@test occursin("\n```\n", str)
198209

210+
doc.data = Dict(
211+
:binding => Docs.Binding(M, :g_2),
212+
:typesig => Tuple{Integer},
213+
:module => M,
214+
)
215+
DSE.format(TYPEDSIGNATURES, buf, doc)
216+
str = String(take!(buf))
217+
@test occursin("\n```julia\n", str)
218+
@test occursin("\ng_2(x::Integer)", str)
219+
@test occursin("\n```\n", str)
199220

200221
doc.data = Dict(
201222
:binding => Docs.Binding(M, :h),

0 commit comments

Comments
 (0)