Package: doctest 0.4.0

David Hugh-Jones

doctest: Generate Tests from Examples Using 'roxygen' and 'testthat'

Creates 'testthat' tests from 'roxygen' examples using simple tags.

Authors:David Hugh-Jones [aut, cre]

doctest_0.4.0.tar.gz
doctest_0.4.0.zip(r-4.7)doctest_0.4.0.zip(r-4.6)doctest_0.4.0.zip(r-4.5)
doctest_0.4.0.tgz(r-4.6-any)doctest_0.4.0.tgz(r-4.5-any)
doctest_0.4.0.tar.gz(r-4.7-any)doctest_0.4.0.tar.gz(r-4.6-any)
doctest_0.4.0.tgz(r-4.6-emscripten)
manual.pdf |manual.html
DESCRIPTION |NEWS
card.svg |card.png
doctest/json (API)

# Install 'doctest' in R:
install.packages('doctest', repos = c('https://community.r-multiverse.org', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/hughjonesd/doctest/issues

Pkgdown/docs site:https://hughjonesd.github.io

On CRAN:

Conda:

6.52 score 31 stars 3 scripts 1.2k downloads 2 exports 35 dependencies

Last updated from:ef97b06623 (on v0.4.0). Checks:9 OK. Indexed: no.

TargetResultTimeFilesSyslog
linux-devel-x86_64OK132
source / vignettesOK167
linux-release-x86_64OK140
macos-release-arm64OK99
macos-oldrel-arm64OK92
windows-develOK95
windows-releaseOK76
windows-oldrelOK74
wasm-releaseOK126

Exports:dt_roclettest_doctests

Dependencies:brewbriocallrclicommonmarkcpp11crayondescdiffobjevaluatefsgluehighrjsonliteknitrlifecyclemagrittrotelpkgbuildpkgloadpraiseprocessxpspurrrR6rlangroxygen2rprojroottestthatvctrswaldowithrxfunxml2yaml

Converting a package to use doctest
Setting up doctest | Converting @examples to @doctest sections | Before | After | Creating doctests by adding expectations | Doctests for messaging functions | Adding doctests for utility functions | Adding doctest to Suggests: | Conclusion

Last update: 2025-12-04
Started: 2022-12-14

doctest
Introduction to doctest | Adding doctests to your package | Tags | @doctest | @expect | @expectRaw | @snap | @testRaw | @omit and @resume | @doctestExample | Caveats | Writing good doctests | Related packages

Last update: 2023-04-28
Started: 2022-11-25

Readme and manuals

Help Manual

Help pageTopics
Write testthat tests for your examples, using roxygen tagsdoctest-package doctest
Start a doctest@doctest doctest-tag
Add an example from a file@doctestExample doctestExample-tag
Create the doctest rocletdt_roclet
Create an expectation@expect expect-tag
Create an expectation as-is@expectRaw expectRaw-tag
Exclude example code from a test@omit @resume omit-tag resume-tag
Create a snapshot test@snap snap-tag
Test doctests in a packagetest_doctests
Add a line of code to the test@testRaw testRaw-tag