port runit tests to a minimal in-package test harness - #264
Merged
Conversation
Replace the RUnit-based test suite with plain 'tests/test-*.R' scripts and a small helper set shipped in the package (R/test.R): - test_init() does the shared setup (clears R_TESTS, seeds the RNG, picks a default backend) and summons the RcppParallel namespace into the calling script so internal functions are referenceable without the ':::' prefix - summon() copies the namespace into an environment, modelled on renv:::summon() - assert() is a single-condition check that also understands the all.equal() idiom, surfacing the reported difference on failure Port the five inst/tests/runit.*.R files to tests/test-*.R using these helpers and base-R assertions, and rename the existing plain-R tests to the same 'test-*.R' convention. Remove tests/doRUnit.R, the old RUnit tests, and the RUnit dependency from DESCRIPTION.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replaces the RUnit-based test suite with plain
tests/test-*.Rscripts backed by a small set of helpers shipped in the package (R/test.R).Motivation
Drop the
RUnitdependency in favour of our own minimal test infrastructure, using base-R tools for assertions.What's here
New helpers in
R/test.R:test_init()— the single entry point each test script calls. ClearsR_TESTS(thestartup.Rsvalue R CMD check sets breaks R sub-processes run from a different working directory), seeds the RNG for reproducibility, and picks a default backend (tinythread, always available) unless one is set. It finishes by summoning the namespace into the calling script.summon()— copies the RcppParallel namespace into an environment so tests can reference internal functions (TBB_ENABLED, etc.) without theRcppParallel:::prefix. Modelled onrenv:::summon().assert(cond)— a single-condition check that throws unless every element isTRUE. It also understands theall.equal()idiom: sinceall.equal()returns a character description on mismatch, a character result is treated as a failure and its diff is surfaced.Tests:
inst/tests/runit.*.Rfiles totests/test-*.R, usingassert()/all.equal()in place ofcheckEquals(). The C++ sources stay ininst/tests/cpp/(still sourced viasystem.file()).scalable-allocator.R,testInstallLibs.R) to thetest-*.Rconvention and routed them throughtest_init().Removed:
tests/doRUnit.R, the oldinst/tests/runit.*.Rfiles, andRUnitfromDESCRIPTIONSuggests.