Skip to content

Commit 9fcb7b2

Browse files
authored
fix: Use any(nzchar(x)) instead of nchar(x) > 0 (#236)
1 parent 0d43cda commit 9fcb7b2

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

R/test-in-browser.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ test_in_browser <- function(
3838
return()
3939
}
4040
proc_output_lines <- app_proc$read_output_lines()
41-
if (any(nchar(proc_output_lines) > 0)) {
41+
if (any(nzchar(proc_output_lines))) {
4242
output_lines_val <<- paste0(
4343
output_lines_val,
44-
if (nchar(output_lines_val) > 0) "\n",
44+
if (nzchar(output_lines_val)) "\n",
4545
paste0(proc_output_lines, collapse = "\n")
4646
)
4747
}

R/test-in-sso.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ test_in_ssossp <- function(
197197
return("")
198198
}
199199
out <- docker_proc$read_output_lines()
200-
if (length(out) > 0 && nchar(out) > 0) {
200+
if (length(out) > 0 && any(nzchar(out))) {
201201
paste0(out, collapse = "\n")
202202
} else {
203203
""
@@ -218,7 +218,7 @@ test_in_ssossp <- function(
218218
Sys.sleep(0.5) # arbitrary, but it'll be a while till the docker is launched
219219
# display all docker output
220220
out <- get_docker_output()
221-
if (nchar(out) > 0) {
221+
if (any(nzchar(out))) {
222222
cat(out, "\n", sep = "")
223223
}
224224
invisible()
@@ -248,10 +248,10 @@ test_in_ssossp <- function(
248248
return("(dead)")
249249
}
250250
docker_proc_output_lines <- docker_proc$read_output_lines()
251-
if (any(nchar(docker_proc_output_lines) > 0)) {
251+
if (any(nzchar(docker_proc_output_lines))) {
252252
output_lines <<- paste0(
253253
output_lines,
254-
if (nchar(output_lines) > 0) "\n",
254+
if (nzchar(output_lines)) "\n",
255255
paste0(docker_proc_output_lines, collapse = "\n")
256256
)
257257
}

0 commit comments

Comments
 (0)