Created
June 28, 2024 12:55
-
-
Save PietrH/54b88f01ef9198b6e60ec09a7bd2104b to your computer and use it in GitHub Desktop.
Do all exported functions have a corresponding testthat unit test file?
This file contains 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
library(magrittr) | |
exported_functions <- | |
readr::read_lines("NAMESPACE") %>% | |
stringr::str_extract("(?<=export\\().+(?=\\))") %>% | |
.[!is.na(.)] | |
unit_tests <- | |
list.files("tests/testthat/") %>% | |
stringr::str_extract("(?<=test-).+(?=\\.R)") %>% | |
.[!is.na(.)] | |
# Do all exported functions have a unit test file named after them? | |
all(exported_functions %in% unit_tests) | |
# Which ones do not? | |
exported_functions[!exported_functions %in% unit_tests] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment