Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitad37db2

Browse files
authored
Merge pull request#442 from katrinabrock/fix-config
2 parentsbbfde07 +7bb579d commitad37db2

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

‎R/zzz-pkgdepends-config.R‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ default_windows_archs <- function() {
66

77
default_update_after<-function() as.difftime(24,units="hours")
88

9-
env_decode_dependencies<-function(x,name) {
9+
env_decode_dependencies<-function(x,name,...) {
1010
if (tolower(x)%in% c("yes","true","1","on"))return(TRUE)
1111
if (tolower(x)%in% c("no","false","0","off"))return(FALSE)
1212
if (tolower(x)=="na")return(NA)
1313
strsplit(x,";",fixed=TRUE)[[1]]
1414
}
1515

16-
env_decode_difftime<-function(x,name) {
16+
env_decode_difftime<-function(x,name,...) {
1717
if (nchar(x)>=2) {
1818
unit<- substr(x, nchar(x), nchar(x))
1919
unit<- c(s="secs",m="mins",h="hours",d="days")[unit]

‎tests/testthat/test-config.R‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
test_that("current_config runs without error", {
2+
expect_no_error(current_config())
3+
})
4+
5+
test_that("current_config runs without error when difftime config set", {
6+
withr::local_envvar(PKG_SYSREQS_DB_UPDATE_TIMEOUT="30")
7+
expect_error(
8+
current_config()$get("sysreqs_db_update_timeout"),
9+
"Invalid time interval specification"
10+
)
11+
withr::local_envvar(PKG_SYSREQS_DB_UPDATE_TIMEOUT="30s")
12+
expect_equal(
13+
current_config()$get("sysreqs_db_update_timeout"),
14+
as.difftime(30,units='secs'),
15+
ignore_attr=TRUE
16+
)
17+
withr::local_envvar(PKG_SYSREQS_DB_UPDATE_TIMEOUT="30h")
18+
expect_equal(
19+
current_config()$get("sysreqs_db_update_timeout"),
20+
as.difftime(30,units="hours"),
21+
ignore_attr=TRUE
22+
)
23+
})
24+
stopifnot(Sys.getenv('PKG_SYSREQS_DB_UPDATE_TIMEOUT')=='')

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp