Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

atime_pkg gains tests.R.path arg #41

Merged
merged 5 commits into from
Apr 12, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions R/versions.R
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ atime_versions_exprs <- function(pkg.path, expr, sha.vec=NULL, verbose=FALSE, pk
a.args
}

atime_pkg <- function(pkg.path="."){
atime_pkg <- function(pkg.path=".", tests.R.path=file.path("inst", "atime", "tests.R"))){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

even tests.dir would be enough, it could be nice to require ${dir}/atime/tests.R for consistency.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok I updated, is that what you meant?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, looks great.

## For an example package see
## https://github.com/tdhock/binsegRcpp/blob/another-branch/inst/atime/tests.R
each.sign.rank <- unit <- . <- N <- expr.name <- reference <- fun.name <-
Expand Down Expand Up @@ -211,7 +211,7 @@ atime_pkg <- function(pkg.path="."){
mb.commit <- git2r::merge_base(HEAD.commit, base.commit)
add_if_new("merge-base", mb.commit)
}
tests.R <- file.path(pkg.path, "inst", "atime", "tests.R")
tests.R <- file.path(pkg.path, tests.R.path)
test.env <- new.env()
tests.parsed <- parse(tests.R)
eval(tests.parsed, test.env)
Expand Down
5 changes: 3 additions & 2 deletions man/atime_pkg.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
\usage{atime_pkg(pkg.path)}
\arguments{
\item{pkg.path}{path to git repository containing R package.}
\item{tests.R.path}{path of tests R code file, relative to \code{pkg.path}.}
}
\details{
There should be a file named pkg.path/inst/atime/tests.R which
There should be a tests R code file which
defines \code{test.list}, a list with names corresponding to different
tests.
Each element should be a list with at least three named elements: \code{N},
Expand All @@ -22,7 +23,7 @@
CRAN is current published version (sha value \code{""}),
merge-base is most recent common ancestor commit between base and
HEAD.
The tests.R file can define \code{version.colors} which should be
The tests R code file can define \code{version.colors} which should be
a character vector (names for versions, values for colors).
}
\value{Named list, names come from names of \code{test.list}, and values
Expand Down
Loading