Skip to main content

declared_test_modules

Function declared_test_modules 

Source
pub fn declared_test_modules(files: &[ModuleFile<'_>]) -> Vec<bool>
Expand description

Which of these files are the body of a module the tree declares test-only.

Returns one flag per input, in the same order. A file is flagged when some file declares it with #[cfg(test)] mod <name>;, and so is everything that file declares in turn: a test module’s own submodules are part of the suite whether or not anybody repeated the attribute on them.

Only declarations at a file’s top level are followed. One written inside an inline mod names a file in a directory nested a further level down, and resolving that would mean tracking the module path a declaration sits at — worth doing when a project turns up that needs it, and not before.