You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As described in the documentation of Documenter.jl,
it is a good idea to add, by default, the expression DocMeta.setdocmeta!({{{PKG}}}, :DocTestSetup, :(using {{{PKG}}}); recursive=true) before doctest({{{PKG}}})
or inside of make.jl i.e.
using {{{PKG}}}
using Documenter
DocMeta.setdocmeta!({{{PKG}}}, :DocTestSetup, :(using {{{PKG}}}); recursive=true)
makedocs(;
modules=[{{{PKG}}}],
.........
This is required if one wants to run doctest of methods defined in one's Package (Say PkgName for example).
Assume PkgName.jl has a domath function (see the code below):
module PkgName
""" domath(x::Number)Return `x + 5`.```jldoctestjulia> domath(3)8```"""domath(x::Number) = x +5export domath
end
Both following commands will fail with a message ERROR: UndefVarError: domath not defined
if DocMeta.setdocmeta!(PkgName, :DocTestSetup, :(using PkgName); recursive=true) is missing.
`
$ julia --project=docs docs/make.jl
$ julia --project=docs -e ' using Documenter: doctest using PkgName doctest(PkgName)'
Any ideas ?
The text was updated successfully, but these errors were encountered:
Both following commands will fail with a message ERROR: UndefVarError: domath not defined
if DocMeta.setdocmeta!(PkgName, :DocTestSetup, :(using PkgName); recursive=true) is missing.
`
$ julia --project=docs docs/make.jl
$ julia --project=docs -e '
using Documenter: doctest
using PkgName
doctest(PkgName)'
Any ideas ?
Yes, the second example is not using docs/make.jl at all, so you either need to do DocMeta.setdocmeta! there as well, or figure out a way to pass an argument to make.jl, that will make it run only the doctest.
As described in the documentation of Documenter.jl,
it is a good idea to add, by default, the expression
DocMeta.setdocmeta!({{{PKG}}}, :DocTestSetup, :(using {{{PKG}}}); recursive=true)
beforedoctest({{{PKG}}})
or inside of
make.jl
i.e.This is required if one wants to run doctest of methods defined in one's Package (Say
PkgName
for example).Assume
PkgName.jl
has adomath
function (see the code below):Both following commands will fail with a message
ERROR: UndefVarError: domath not defined
if
DocMeta.setdocmeta!(PkgName, :DocTestSetup, :(using PkgName); recursive=true)
is missing.`
$ julia --project=docs docs/make.jl
Any ideas ?
The text was updated successfully, but these errors were encountered: