Skip to content

testit 1.3

Latest

Choose a tag to compare

@yihui yihui released this 02 Nov 19:12
· 3 commits to master since this release
  • %==% diagnostics normalize str() output by removing the common leading spaces, so failure messages and snapshots are the same across R versions (R-devel stopped padding top-level str() output).

  • Removed support for sourcing global helper*.R files placed directly in the parent of the test directory (e.g., tests/helper.R). Put shared helpers in a sibling helpers/ directory (e.g., tests/helpers/) instead.

  • has_match() gained a fixed argument (passed to grepl()) to match pattern literally. A fixed search no longer has the Perl/dotall flag applied (previously fixed = TRUE via ... left a literal (?s) prepended to the pattern, so the match failed, and grepl() warned about perl = TRUE being ignored).

  • has_match() treats a pattern wrapped in I() as a shorthand for fixed = TRUE, i.e. has_match(x, I(p)) matches p literally.

  • has_match() accepts !pattern as a shorthand for negate = TRUE, i.e. has_match(x, !p) tests that x does not match p.

  • test_pkg() temporarily unsets the environment variable R_TESTS (which R CMD check sets to a relative path, startup.Rs) while tests run. Previously child R processes started from tests (e.g., future or parallel workers) failed at startup because the relative path could not be resolved from the test directory.