`assert_all_are_dirs` in `assertive.base` does not seem to catch anything

Create issue
Issue #24 new
Mike Williamson created an issue

Simple reproducible example from the Testing R Code book:

contents_of_base_pkg_dir <- dir(
  system.file(package = "base"),
  full.names = TRUE


This call returns nothing (meaning that all of those files are directories). In case you might think they all are, add the following:

contents_of_base_pkg_dir <- c(contents_of_base_pkg_dir, "1441") # Or whatever you want


This still silently passes, even though it should fail.

environment info:

assertive.files version: 0.0-2

R version: 3.4.3 (2017-11-30) Kite-Eating Tree


Sys.info() sysname "Darwin" release "17.4.0" version "Darwin Kernel Version 17.4.0: Sun Dec 17 09:19:54 PST 2017; root:xnu-4570.41.2~1/RELEASE_X86_64" nodename "MacBook-Pro.attlocal.net" machine "x86_64" login "mike" user "mike" effective_user "mike"

Regards, Mike Williamson

Comments (4)

  1. Felix Ernst

    actually the assert_all_are_dirs is a copy of assert_any_are_dirs. Have a look at the source code: what = "any" instead of what = "all".

    @richierocks: When will the next release happen? Thanks for the package

  2. Mike Williamson reporter

    Hi @FelixGMErnst OK, thanks for your clarification. However, isn't that an error? assert_all_are_dirs should work as I described.

    This still seems worthy of flagging as an issue, even if we understand why it does not work and what the fix is. At the very least, it gives a really easy bug fix; a sense of accomplishment when having "one of those days"... ;-p

  3. Log in to comment