Skip to content

Commit cfca5f7

Browse files
fix output
1 parent 4c9a194 commit cfca5f7

File tree

5 files changed

+9
-6
lines changed

5 files changed

+9
-6
lines changed

R/ui.R

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ style_pkg <- function(pkg = ".",
3939
transformers = style(...),
4040
exclude_files = "R/RcppExports.R") {
4141
pkg_root <- rprojroot::find_package_root_file(path = pkg)
42-
withr::with_dir(pkg_root, prettify_local(transformers, exclude_files))
42+
changed <- withr::with_dir(pkg_root, prettify_local(transformers, exclude_files))
43+
invisible(changed)
4344
}
4445

4546
prettify_local <- function(transformers, exclude_files) {
@@ -104,9 +105,10 @@ style_dir <- function(path = ".",
104105
transformers = style(...),
105106
recursive = TRUE,
106107
exclude_files = NULL) {
107-
withr::with_dir(
108+
changed <- withr::with_dir(
108109
path, prettify_any(transformers, recursive, exclude_files)
109110
)
111+
invisible(changed)
110112
}
111113

112114
#' Prettify R code in current working directory
@@ -145,8 +147,9 @@ style_file <- function(path,
145147
...,
146148
style = tidyverse_style,
147149
transformers = style(...)) {
148-
withr::with_dir(
150+
changed <- withr::with_dir(
149151
dirname(path),
150152
transform_files(basename(path), transformers)
151153
)
154+
invisible(changed)
152155
}
Binary file not shown.
Binary file not shown.
Binary file not shown.

tests/testthat/test-public_api.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ test_that("messages (via cat()) of style_file are correct", {
8080
temp_path <- copy_to_tempdir(testthat_file(
8181
"public-api", "xyzdir-dirty", "dirty-sample-with-scope-tokens.R"
8282
))
83-
expect_equal_to_reference(enc::to_utf8(capture_output(
83+
expect_equal_to_reference(enc::to_utf8(capture.output(
8484
style_file(temp_path, scope = "tokens"))),
8585
testthat_file("public-api/xyzdir-dirty/dirty-reference-with-scope-tokens")
8686
)
@@ -89,15 +89,15 @@ test_that("messages (via cat()) of style_file are correct", {
8989
# No message if scope > line_breaks and code does not change
9090
temp_path <- copy_to_tempdir(testthat_file("public-api", "xyzdir-dirty", "clean-sample-with-scope-tokens.R"))
9191
expect_equal_to_reference(
92-
enc::to_utf8(capture_output(style_file(temp_path, scope = "tokens"))),
92+
enc::to_utf8(capture.output(style_file(temp_path, scope = "tokens"))),
9393
testthat_file("public-api/xyzdir-dirty/clean-reference-with-scope-tokens")
9494
)
9595
unlink(dirname(temp_path))
9696

9797
# No message if scope <= line_breaks even if code is changed.
9898
temp_path <- copy_to_tempdir(testthat_file("public-api", "xyzdir-dirty", "dirty-sample-with-scope-spaces.R"))
9999
expect_equal_to_reference(
100-
enc::to_utf8(capture_output(style_file(temp_path, scope = "spaces"))),
100+
enc::to_utf8(capture.output(style_file(temp_path, scope = "spaces"))),
101101
testthat_file("public-api/xyzdir-dirty/dirty-reference-with-scope-spaces")
102102
)
103103
unlink(dirname(temp_path))

0 commit comments

Comments
 (0)