Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mpadge committed Jul 10, 2024
1 parent 98fa01c commit 366799c
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 2 deletions.
4 changes: 3 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: githist
Title: Code analyses traced along the 'git' history of a package
Version: 0.0.1.014
Version: 0.0.1.015
Authors@R:
person("Mark", "Padgham", , "mark.padgham@email.com", role = c("aut", "cre"),
comment = c(ORCID = "0000-0003-2172-5265"))
Expand All @@ -16,6 +16,8 @@ Imports:
gert,
pbapply,
pkgstats
Suggests:
testthat (>= 3.0.0)
Remotes:
ropensci-review-tools/pkgstats
Config/testthat/edition: 3
Expand Down
2 changes: 1 addition & 1 deletion codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"codeRepository": "https://github.com/ropensci-review-tools/githist",
"issueTracker": "https://github.com/ropensci-review-tools/githist/issues",
"license": "https://spdx.org/licenses/GPL-3.0",
"version": "0.0.1.014",
"version": "0.0.1.015",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "R",
Expand Down
Binary file added inst/extdata/testpkg.zip
Binary file not shown.
12 changes: 12 additions & 0 deletions tests/testthat.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# This file is part of the standard setup for testthat.
# It is recommended that you do not modify it.
#
# Where should you do additional test configuration?
# Learn more about the roles of various files in:
# * https://r-pkgs.org/testing-design.html#sec-tests-files-overview
# * https://testthat.r-lib.org/articles/special-files.html

library (testthat)
library (githist)

test_check ("githist")
12 changes: 12 additions & 0 deletions tests/testthat/test-testpkg.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
test_that ("testpkg", {
pkg <- system.file ("extdata", "testpkg.zip", package = "githist")
flist <- unzip (pkg, exdir = fs::path_temp ())
path <- fs::path_dir (flist [1])

res <- githist (path)

expect_type (res, "list")
expect_length (res, 3L)
expect_identical (names (res), c ("desc_data", "loc", "stats"))
expect_true (all (vapply (res, nrow, integer (1L)) > 1L))
})

0 comments on commit 366799c

Please sign in to comment.