From b9e27de24117f931b79d2a1b3d31a47ad30e012d Mon Sep 17 00:00:00 2001 From: mpadge Date: Wed, 13 Nov 2024 12:28:35 +0100 Subject: [PATCH] extend tests for #11 --- DESCRIPTION | 2 +- codemeta.json | 9 ++++++--- tests/testthat/test-chaoss-metrics-external.R | 11 +++++++++++ tests/testthat/test-testpkg.R | 9 +++++++++ 4 files changed, 27 insertions(+), 4 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 3620594..baf9e28 100755 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: githist Title: Code analyses traced along the 'git' history of a package -Version: 0.1.0.043 +Version: 0.1.0.044 Authors@R: person("Mark", "Padgham", , "mark.padgham@email.com", role = c("aut", "cre"), comment = c(ORCID = "0000-0003-2172-5265")) diff --git a/codemeta.json b/codemeta.json index 05a10de..9fa5a9c 100644 --- a/codemeta.json +++ b/codemeta.json @@ -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.1.0.43", + "version": "0.1.0.044", "programmingLanguage": { "@type": "ComputerLanguage", "name": "R", @@ -223,10 +223,13 @@ "name": "pkgstats", "sameAs": "https://github.com/ropensci-review-tools/pkgstats" }, - "SystemRequirements": null + "SystemRequirements": {} }, "fileSize": "90.739KB", "readme": "https://github.com/ropensci-review-tools/githist/blob/main/README.md", - "contIntegration": ["https://github.com/ropensci-review-tools/githist/actions?query=workflow%3AR-CMD-check", "https://app.codecov.io/gh/ropensci-review-tools/githist"], + "contIntegration": [ + "https://github.com/ropensci-review-tools/githist/actions?query=workflow%3AR-CMD-check", + "https://app.codecov.io/gh/ropensci-review-tools/githist" + ], "developmentStatus": "https://www.repostatus.org/#active" } diff --git a/tests/testthat/test-chaoss-metrics-external.R b/tests/testthat/test-chaoss-metrics-external.R index 3489b35..5d59dbc 100644 --- a/tests/testthat/test-chaoss-metrics-external.R +++ b/tests/testthat/test-chaoss-metrics-external.R @@ -1,3 +1,14 @@ +test_that ("chaoss external util fns", { + pkg <- system.file ("extdata", "testpkg.zip", package = "githist") + flist <- unzip (pkg, exdir = fs::path_temp ()) + path <- fs::path_dir (flist [1]) + + pkg_name <- pkg_name_from_path (path) + expect_equal (pkg_name, "testpkg") + + fs::dir_delete (path) +}) + test_that ("chaoss external cran_downloads", { pkg_name <- "goodpractice" diff --git a/tests/testthat/test-testpkg.R b/tests/testthat/test-testpkg.R index 47cc89c..2ab34d7 100644 --- a/tests/testthat/test-testpkg.R +++ b/tests/testthat/test-testpkg.R @@ -47,4 +47,13 @@ test_that ("githist parameters", { length (res2$desc_dat$date), length (unique (res2$desc_data$date)) ) + + # Finally, test step_days > 1, which has no effect anyway, as all commits + # are on same day + flist <- unzip (pkg, exdir = fs::path_temp ()) + res3 <- githist (path, n = 2L, step_days = 2L, num_cores = 1L) + fs::dir_delete (path) + + n3 <- vapply (res3, nrow, integer (1L)) + expect_equal (n2, n3) })