Skip to content

Commit

Permalink
Create tests with kwb.test::create_test_files()
Browse files Browse the repository at this point in the history
and modify some tests.

Skip tests that would detach testthat!
Skip test that would install the remotes package!
  • Loading branch information
hsonne committed May 2, 2024
1 parent b43763e commit cebc736
Show file tree
Hide file tree
Showing 84 changed files with 1,295 additions and 2 deletions.
4 changes: 3 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@ Suggests:
covr,
knitr,
pkgmeta,
rmarkdown
rmarkdown,
testthat (>= 3.0.0)
Remotes:
github::kwb-r/kwb.utils,
github::kwb-r/pkgmeta
Encoding: UTF-8
RoxygenNote: 7.3.1
VignetteBuilder: knitr
Config/testthat/edition: 3
1 change: 0 additions & 1 deletion R/install.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ updateKwbPackages <- function
}
}


# getServername ------------------------------------------------------------

#' Get KWB Servername
Expand Down
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/tests.html
# * https://testthat.r-lib.org/reference/test_package.html#special-files

library(testthat)
library(kwb.package)

test_check("kwb.package")
Binary file added tests/testthat/Rplots.pdf
Binary file not shown.
17 changes: 17 additions & 0 deletions tests/testthat/test-function-addNodeLabels.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#
# This file was generated by kwb.test::create_test_files(),
# launched by hsonne on 2024-05-02 18:06:13.
# Please modify the dummy functions so that real cases are
# tested. Then, delete this comment.
#

test_that("addNodeLabels() works", {

f <- kwb.package::addNodeLabels

expect_error(
f()
# Argument "nodes" fehlt (ohne Standardwert)
)

})
17 changes: 17 additions & 0 deletions tests/testthat/test-function-allDeps.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#
# This file was generated by kwb.test::create_test_files(),
# launched by hsonne on 2024-05-02 17:58:25.
# Please modify the dummy functions so that real cases are
# tested. Then, delete this comment.
#

test_that("allDeps() works", {

f <- kwb.package:::allDeps

expect_error(
f()
# Argument "name" fehlt (ohne Standardwert)
)

})
17 changes: 17 additions & 0 deletions tests/testthat/test-function-anglesToPoints.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#
# This file was generated by kwb.test::create_test_files(),
# launched by hsonne on 2024-05-02 18:06:13.
# Please modify the dummy functions so that real cases are
# tested. Then, delete this comment.
#

test_that("anglesToPoints() works", {

f <- kwb.package::anglesToPoints

expect_error(
f()
# Argument "angles.grad" fehlt (ohne Standardwert)
)

})
17 changes: 17 additions & 0 deletions tests/testthat/test-function-archivedCranVersions.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#
# This file was generated by kwb.test::create_test_files(),
# launched by hsonne on 2024-05-02 17:58:25.
# Please modify the dummy functions so that real cases are
# tested. Then, delete this comment.
#

test_that("archivedCranVersions() works", {

f <- kwb.package::archivedCranVersions

expect_error(
f()
# Argument "package" fehlt (ohne Standardwert)
)

})
17 changes: 17 additions & 0 deletions tests/testthat/test-function-cleanStop.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#
# This file was generated by kwb.test::create_test_files(),
# launched by hsonne on 2024-05-02 18:06:14.
# Please modify the dummy functions so that real cases are
# tested. Then, delete this comment.
#

test_that("cleanStop() works", {

f <- kwb.package:::cleanStop

expect_error(
f()
#
)

})
17 changes: 17 additions & 0 deletions tests/testthat/test-function-compareInstalledVersions.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#
# This file was generated by kwb.test::create_test_files(),
# launched by hsonne on 2024-05-02 17:58:25.
# Please modify the dummy functions so that real cases are
# tested. Then, delete this comment.
#

test_that("compareInstalledVersions() works", {

f <- kwb.package::compareInstalledVersions

expect_error(
f()
# Argument "lib1" fehlt (ohne Standardwert)
)

})
17 changes: 17 additions & 0 deletions tests/testthat/test-function-copyBasePackages.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#
# This file was generated by kwb.test::create_test_files(),
# launched by hsonne on 2024-05-02 17:58:25.
# Please modify the dummy functions so that real cases are
# tested. Then, delete this comment.
#

test_that("copyBasePackages() works", {

f <- kwb.package::copyBasePackages

expect_error(
f()
# Argument "target_lib" fehlt (ohne Standardwert)
)

})
17 changes: 17 additions & 0 deletions tests/testthat/test-function-cranVersions.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#
# This file was generated by kwb.test::create_test_files(),
# launched by hsonne on 2024-05-02 17:58:26.
# Please modify the dummy functions so that real cases are
# tested. Then, delete this comment.
#

test_that("cranVersions() works", {

f <- kwb.package::cranVersions

expect_error(
f()
# Argument "name" fehlt (ohne Standardwert)
)

})
12 changes: 12 additions & 0 deletions tests/testthat/test-function-currentCranVersion.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#library(testthat)

test_that("currentCranVersion() works", {

f <- kwb.package:::currentCranVersion

result <- f()

expect_s3_class(result, "data.frame")
expect_identical(names(result), c("package", "version", "date", "date_type"))

})
10 changes: 10 additions & 0 deletions tests/testthat/test-function-defaultLocalCRAN.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#library(testthat)

test_that("defaultLocalCRAN() works", {

f <- kwb.package:::defaultLocalCRAN

result <- f()
expect_true(endsWith(result, "/local-cran"))

})
12 changes: 12 additions & 0 deletions tests/testthat/test-function-defaultPackageDir.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#library(testthat)

test_that("defaultPackageDir() works", {

f <- kwb.package:::defaultPackageDir

result <- f()

expect_type(result, "character")
expect_length(result, 1L)

})
11 changes: 11 additions & 0 deletions tests/testthat/test-function-detachAllNonSystemPackages.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#library(testthat)

testthat::skip("Do not detach testthat!")

test_that("detachAllNonSystemPackages() works", {

f <- kwb.package::detachAllNonSystemPackages

expect_output(f())

})
11 changes: 11 additions & 0 deletions tests/testthat/test-function-detachRecursively.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#library(testthat)

testthat::skip("Do not detach testthat!")

test_that("detachRecursively() works", {

f <- kwb.package::detachRecursively

expect_error(f())

})
9 changes: 9 additions & 0 deletions tests/testthat/test-function-dirPackageZips.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#library(testthat)

test_that("dirPackageZips() works", {

f <- kwb.package:::dirPackageZips

expect_error(f())

})
17 changes: 17 additions & 0 deletions tests/testthat/test-function-downloadGitHubPackage.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#
# This file was generated by kwb.test::create_test_files(),
# launched by hsonne on 2024-05-02 17:58:28.
# Please modify the dummy functions so that real cases are
# tested. Then, delete this comment.
#

test_that("downloadGitHubPackage() works", {

f <- kwb.package::downloadGitHubPackage

expect_error(
f()
# Argument "repo" fehlt (ohne Standardwert)
)

})
17 changes: 17 additions & 0 deletions tests/testthat/test-function-downloadPackagesFromSnapshot.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#
# This file was generated by kwb.test::create_test_files(),
# launched by hsonne on 2024-05-02 17:58:28.
# Please modify the dummy functions so that real cases are
# tested. Then, delete this comment.
#

test_that("downloadPackagesFromSnapshot() works", {

f <- kwb.package::downloadPackagesFromSnapshot

expect_error(
f()
# Argument "packages" fehlt (ohne Standardwert)
)

})
17 changes: 17 additions & 0 deletions tests/testthat/test-function-drawDependencies.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#
# This file was generated by kwb.test::create_test_files(),
# launched by hsonne on 2024-05-02 18:06:13.
# Please modify the dummy functions so that real cases are
# tested. Then, delete this comment.
#

test_that("drawDependencies() works", {

f <- kwb.package::drawDependencies

expect_error(
f()
# Argument "nodes" fehlt (ohne Standardwert)
)

})
17 changes: 17 additions & 0 deletions tests/testthat/test-function-drawLink.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#
# This file was generated by kwb.test::create_test_files(),
# launched by hsonne on 2024-05-02 18:06:13.
# Please modify the dummy functions so that real cases are
# tested. Then, delete this comment.
#

test_that("drawLink() works", {

f <- kwb.package::drawLink

expect_error(
f()
# Argument "nodes" fehlt (ohne Standardwert)
)

})
17 changes: 17 additions & 0 deletions tests/testthat/test-function-draw_circles.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#
# This file was generated by kwb.test::create_test_files(),
# launched by hsonne on 2024-05-02 18:06:13.
# Please modify the dummy functions so that real cases are
# tested. Then, delete this comment.
#

test_that("draw_circles() works", {

f <- kwb.package:::draw_circles

expect_error(
f()
# Argument "r" fehlt (ohne Standardwert)
)

})
17 changes: 17 additions & 0 deletions tests/testthat/test-function-equidistantAngles.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#
# This file was generated by kwb.test::create_test_files(),
# launched by hsonne on 2024-05-02 18:06:13.
# Please modify the dummy functions so that real cases are
# tested. Then, delete this comment.
#

test_that("equidistantAngles() works", {

f <- kwb.package::equidistantAngles

expect_error(
f()
# Argument "n" fehlt (ohne Standardwert)
)

})
17 changes: 17 additions & 0 deletions tests/testthat/test-function-exampleLinksAndNodes.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#
# This file was generated by kwb.test::create_test_files(),
# launched by hsonne on 2024-05-02 18:06:14.
# Please modify the dummy functions so that real cases are
# tested. Then, delete this comment.
#

test_that("exampleLinksAndNodes() works", {

f <- kwb.package::exampleLinksAndNodes

expect_error(
f()
# line 8 did not have 4 elements
)

})
17 changes: 17 additions & 0 deletions tests/testthat/test-function-findPackageFilename.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#
# This file was generated by kwb.test::create_test_files(),
# launched by hsonne on 2024-05-02 17:58:28.
# Please modify the dummy functions so that real cases are
# tested. Then, delete this comment.
#

test_that("findPackageFilename() works", {

f <- kwb.package:::findPackageFilename

expect_error(
f()
# Argument "tarfile" fehlt (ohne Standardwert)
)

})
Loading

0 comments on commit cebc736

Please sign in to comment.