Skip to content

Commit

Permalink
chore: make linter happy (#309)
Browse files Browse the repository at this point in the history
  • Loading branch information
eitsupi authored Aug 15, 2023
1 parent 82a7be8 commit 5ebc150
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 33 deletions.
32 changes: 16 additions & 16 deletions R/source.R
Original file line number Diff line number Diff line change
Expand Up @@ -441,22 +441,22 @@ check_cargo_output <- function(compilation_result, message_buffer, tty_has_color
"error",
tty_has_colors
) %>%
purrr::map_chr(
cli::format_inline,
keep_whitespace = TRUE
) %>%
# removing double new lines with single new line
stringi::stri_replace_all_fixed("\n\n", "\n") %>%
# ensures that the leading cli style `x` is there
rlang::set_names("x")

rlang::abort(
c(
"Rust code could not be compiled successfully. Aborting.",
error_messages
),
call = call,
class = "rextendr_error"
purrr::map_chr(
cli::format_inline,
keep_whitespace = TRUE
) %>%
# removing double new lines with single new line
stringi::stri_replace_all_fixed("\n\n", "\n") %>%
# ensures that the leading cli style `x` is there
rlang::set_names("x")

rlang::abort(
c(
"Rust code could not be compiled successfully. Aborting.",
error_messages
),
call = call,
class = "rextendr_error"
)
}
}
Expand Down
36 changes: 19 additions & 17 deletions tests/testthat/test-pretty_rel_path.R
Original file line number Diff line number Diff line change
Expand Up @@ -89,24 +89,26 @@ test_that("Find relative path providing NA as input for the package directory, r
)
})

test_that("Find relative path providing empty character vector as
input for the package directory, return absolute path", {
skip_if_not_installed("usethis")

pkg_root <- local_package("testpkg")
use_extendr()

expect_equal(
pretty_rel_path(
file.path(pkg_root, "R", "extendr-wrappers.R"),
character(0)
),
normalizePath(
file.path(pkg_root, "R", "extendr-wrappers.R"),
winslash = "/"
test_that(
"Find relative path providing empty character vector as input for the package directory, return absolute path",
{
skip_if_not_installed("usethis")

pkg_root <- local_package("testpkg")
use_extendr()

expect_equal(
pretty_rel_path(
file.path(pkg_root, "R", "extendr-wrappers.R"),
character(0)
),
normalizePath(
file.path(pkg_root, "R", "extendr-wrappers.R"),
winslash = "/"
)
)
)
})
}
)

test_that("Test path to non-existent file", {
skip_if_not_installed("usethis")
Expand Down

0 comments on commit 5ebc150

Please sign in to comment.