Skip to content

Commit 6fff0ee

Browse files
authored
Fix docstring test for static modeling language.
1 parent c9a0530 commit 6fff0ee

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

test/dsl/static_dsl.jl

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -558,9 +558,16 @@ trace, = generate(foo, (), constraints)
558558
end
559559

560560
@testset "docstrings" begin
561-
io = IOBuffer()
562-
print(io, @doc model)
563-
@test String(take!(io)) == "my documentation\n"
561+
function doc_to_str(doc)
562+
if doc isa Base.Docs.DocStr
563+
# Handle @doc behavior in Julia 1.11 when REPL is not loaded
564+
return doc.text[1]
565+
else
566+
# Handle pre-Julia 1.11 behavior of @doc
567+
return strip(string(doc))
568+
end
569+
end
570+
@test doc_to_str(@doc(model)) == "my documentation\n"
564571
end
565572

566573
@testset "one-line definitions" begin

0 commit comments

Comments
 (0)