I am starting a Julia module and prefer to use only doctests and to skip documentation at this stage. The Julia doctest documentation says that makedocs can run doctests:
Doctesting can be disabled by setting the makedocs keyword
doctest = false.
It mentions no other method of running doctests. Does Julia offer any other way to run doctests?
Note: Here is an example function:
"""
month_to_quarter(date::Date)
Returns the date corresponding to the first day of the quarter enclosing date
#Examples
```jldoctest
julia> Date(1990, 1, 1) == month_to_quarter(Date(1990, 2, 1))
true
julia> Date(1990, 1, 1) == month_to_quarter(Date(1990, 1, 1))
true
julia> Date(1990, 1, 1) == month_to_quarter(Date(1990, 2, 25))
true
```
"""
function month_to_quarter(date::Date)
new_month = 1 + 3 * floor((Dates.month(date) - 1) / 3)
return Date(Dates.year(date), new_month, 1)
end
Aucun commentaire:
Enregistrer un commentaire