Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use_test() creates wrong file if period in file name #1690

Closed
moodymudskipper opened this issue Oct 7, 2022 · 0 comments · Fixed by #1730
Closed

use_test() creates wrong file if period in file name #1690

moodymudskipper opened this issue Oct 7, 2022 · 0 comments · Fixed by #1730
Labels
bug an unexpected problem or unintended behavior code 🖥️ R/, tests/

Comments

@moodymudskipper
Copy link

I'm on a "data.frame.R" tab, it will create a "test-data.R", I expect a "test-data.frame.R" tab.

It's due to slug(), due in turn to fs::path_ext_set() but I think for the latter it's the intended behaviour.

usethis:::slug("data.frame.R", "R")
#> [1] "data.R"

fs::path_ext_set("data.frame", "R")
#> data.R
@hadley hadley added bug an unexpected problem or unintended behavior code 🖥️ R/, tests/ labels Jan 17, 2023
hadley pushed a commit that referenced this issue Jan 17, 2023
* Make it much broader so it now works with any file in `R/`, `src/` or `tests/testthat`. Fixes #1566
* This new foundation made it possible to make `use_c()` and `use_rcpp()` (and friends) to work the same way as `use_r()`/use_test()`.
* Since I was in here I fixed #1690.
* I also refactored the code to make it easier to test.
* I switched the errors I touch to use `cli::cli_abort()` so the messaging can point to the correct user facing function.
* I generally refactored the error handling so it happens in one central location.
hadley pushed a commit that referenced this issue Jan 17, 2023
* Make it much broader so it now works with any file in `R/`, `src/` or `tests/testthat`. Fixes #1566
* This new foundation made it possible to make `use_c()` and `use_rcpp()` (and friends) to work the same way as `use_r()`/use_test()`.
* Since I was in here I fixed #1690.
* I also refactored the code to make it easier to test.
* I switched the errors I touch to use `cli::cli_abort()` so the messaging can point to the correct user facing function.
* I generally refactored the error handling so it happens in one central location.
@hadley hadley closed this as completed in 3c03f5c Jan 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior code 🖥️ R/, tests/
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants