Skip to content

Commit

Permalink
Make compute_name() work when ext is not "R"
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobbien committed Jun 17, 2023
1 parent 97b2891 commit b7e0603
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion R/r.R
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ compute_name <- function(name = NULL, ext = "R", error_call = caller_env()) {

if (path_ext(name) == "") {
name <- path_ext_set(name, ext)
} else if (path_ext(name) != "R") {
} else if (path_ext(name) != ext) {
cli::cli_abort(
"{.arg name} must have extension {.str {ext}}, not {.str {path_ext(name)}}.",
call = error_call
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-r.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ test_that("compute_name() validates its inputs", {
compute_name("")
compute_name("****")
})
expect_equal(compute_name("foo.c", ext = "c"), "foo.c")
})

test_that("compute_active_name() errors if no files open", {
Expand Down

0 comments on commit b7e0603

Please sign in to comment.