-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
♻️ move more out of habit_plots.R and add run_tests.R
- Loading branch information
Showing
4 changed files
with
126 additions
and
47 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/usr/bin/env Rscript | ||
|
||
# run all test_* functions | ||
# test functions are kept next to the actual functions they test. | ||
# this is not idomatic R, where we'd want tests/test_*.R (eg. from `usethis::use_test("habit")`) | ||
# so we need our own wrapper instead of testthat::run_test() | ||
# | ||
# 20231210WF - init | ||
|
||
source('read_raw.R') | ||
#lapply(grep('test_',ls(),value=T),do.call,args=list()) | ||
my_test_funcs <- grep('test_',ls(),value=T) | ||
my_test_funcs <- Filter(function(fname) class(get(fname))=="function", my_test_funcs) | ||
|
||
invisible(lapply(my_test_funcs, | ||
function(tname) | ||
testthat::test_that(tname, { | ||
do.call(tname,args=list()) | ||
}))) |