mllg / checkmate

Fast and versatile argument checks
https://mllg.github.io/checkmate/
Other
263 stars 30 forks source link

Assertions don't trigger on empty vectors #174

Closed mb706 closed 4 years ago

mb706 commented 4 years ago

I want all the following to trigger, but they currently don't.

assertCharacter(integer(0))
assertLogical(integer(0))
assertSubset(integer(0), letters)

Maybe enabling this will break some other code somewhere so this behaviour could be parameterized I guess (or maybe allow these whenever null.ok is TRUE?).

tdeenes commented 4 years ago

Even more worrisome example:

assertInteger(data.table::data.table()) # this passes
mllg commented 4 years ago
assertInteger(data.table::data.table()) # this passes

This is a clear bug and already fixed as part of #199 .

mllg commented 4 years ago

With #199, you can now set typed.missing = TRUE to trigger a type check on empty vectors.