Skip to content

Commit

Permalink
Fix docstring test for static modeling language.
Browse files Browse the repository at this point in the history
  • Loading branch information
ztangent authored Sep 5, 2024
1 parent c9a0530 commit 6fff0ee
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions test/dsl/static_dsl.jl
Original file line number Diff line number Diff line change
Expand Up @@ -558,9 +558,16 @@ trace, = generate(foo, (), constraints)
end

@testset "docstrings" begin
io = IOBuffer()
print(io, @doc model)
@test String(take!(io)) == "my documentation\n"
function doc_to_str(doc)
if doc isa Base.Docs.DocStr
# Handle @doc behavior in Julia 1.11 when REPL is not loaded
return doc.text[1]
else
# Handle pre-Julia 1.11 behavior of @doc
return strip(string(doc))
end
end
@test doc_to_str(@doc(model)) == "my documentation\n"
end

@testset "one-line definitions" begin
Expand Down

0 comments on commit 6fff0ee

Please sign in to comment.