Skip to content

Commit

Permalink
doctest_fix: try setting fixed default terminal size
Browse files Browse the repository at this point in the history
  • Loading branch information
benlorenz committed Oct 1, 2024
1 parent 2fe164e commit c378d49
Showing 1 changed file with 19 additions and 15 deletions.
34 changes: 19 additions & 15 deletions src/utils/docs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,15 @@ function doctest_fix(f::Function; set_meta::Bool = false)
S = Symbol(f)
doc, doctest = get_document(set_meta)

with_unicode(false) do
#essentially inspired by Documenter/src/DocTests.jl
pm = parentmodule(f)
bm = Base.Docs.meta(pm)
md = bm[Base.Docs.Binding(pm, S)]
for s in md.order
doctest(md.docs[s], Oscar, doc)
withenv("COLUMNS"=>80, "LINES"=>24) do
with_unicode(false) do

Check warning on line 74 in src/utils/docs.jl

View check run for this annotation

Codecov / codecov/patch

src/utils/docs.jl#L73-L74

Added lines #L73 - L74 were not covered by tests
#essentially inspired by Documenter/src/DocTests.jl
pm = parentmodule(f)
bm = Base.Docs.meta(pm)
md = bm[Base.Docs.Binding(pm, S)]
for s in md.order
doctest(md.docs[s], Oscar, doc)
end

Check warning on line 81 in src/utils/docs.jl

View check run for this annotation

Codecov / codecov/patch

src/utils/docs.jl#L76-L81

Added lines #L76 - L81 were not covered by tests
end
end
end
Expand All @@ -97,14 +99,16 @@ julia> Oscar.doctest_fix("/Rings/")
function doctest_fix(path::String; set_meta::Bool=false)
doc, doctest = get_document(set_meta)

with_unicode(false) do
walkmodules(Oscar) do m
#essentially inspired by Documenter/src/DocTests.jl
bm = Base.Docs.meta(m)
for (_, md) in bm
for s in md.order
if occursin(path, md.docs[s].data[:path])
doctest(md.docs[s], Oscar, doc)
withenv("COLUMNS"=>80, "LINES"=>24) do
with_unicode(false) do
walkmodules(Oscar) do m

Check warning on line 104 in src/utils/docs.jl

View check run for this annotation

Codecov / codecov/patch

src/utils/docs.jl#L102-L104

Added lines #L102 - L104 were not covered by tests
#essentially inspired by Documenter/src/DocTests.jl
bm = Base.Docs.meta(m)
for (_, md) in bm
for s in md.order
if occursin(path, md.docs[s].data[:path])
doctest(md.docs[s], Oscar, doc)

Check warning on line 110 in src/utils/docs.jl

View check run for this annotation

Codecov / codecov/patch

src/utils/docs.jl#L106-L110

Added lines #L106 - L110 were not covered by tests
end
end
end
end
Expand Down

0 comments on commit c378d49

Please sign in to comment.