Skip to content

Commit c2ffaa0

Browse files
committed
improved doc
1 parent a5bc54a commit c2ffaa0

File tree

6 files changed

+33
-14
lines changed

6 files changed

+33
-14
lines changed

R/test_skeleton.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#' compatibility with testthat.
1616
#'
1717
#' @return `NULL` (invisibly)
18+
#' @seealso [usethis::use_test()]
1819
#'
1920
#' @export
2021
#'

R/test_subdir.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#' Use test subdirectories
1+
#' Run tests in subdirectories
22
#'
33
#' This is a simple wrapper for [devtools::test()], but rather than running
44
#' the tests in \file{inst/tests/} or \file{tests/testthat}, it runs the tests

R/testthis-package.R

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#'
33
#' RStudio addins for several common testing-related tasks during package
44
#' development, such as switching between a source file and an associated test
5-
#' file, or running unit tests in a single test file (hotkeyable!).
5+
#' file, or running unit tests in a single test file (hotkeyable in RStudio!).
66
#' testthis also provides utility function to manage tests in subdirectories of
77
#' the test/testthis directory.
88
#'
@@ -12,14 +12,29 @@
1212
#' @import assertthat
1313
#' @importFrom magrittr %>%
1414
#'
15+
#' @section Setting the project path:
16+
#'
17+
#' Testthis uses [usethis::proj_get()] to detect project root of the current
18+
#' working directory. You can override the project root with
19+
#' [usethis::proj_set()].
20+
#'
1521
#' @section Package options:
1622
#'
23+
#' Package options can be set with [`options()`]. You can add `options()` to
24+
#' your \file{.Rprofile} to make them permanent across sessions.
25+
#'
1726
#' \describe{
27+
#'
1828
#' \item{`testthis.sep`}{Default separator to use when creating test files with
1929
#' `test_skeleton()`. Defaults to `_`, must be either `_` or `-`; i.e whether
2030
#' you want your files to be named `test_foofunction.R` or `test-foofunction.R`}
21-
#' }
2231
#'
32+
#' \item{`testthis.integration_tests_path`, `testthis.acceptance_tests_path`,
33+
#' `testthis.manual_tests_path`}{Default paths used by the functions
34+
#' `testthis::use_integration_tests()`, `testthis::test_integration()`, etc...}
35+
#'}
36+
#'
37+
#' @seealso [usethis::edit_r_profile()]
2338
#' @docType package
2439
"_PACKAGE"
2540

README.Rmd

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ output: github_document
88

99
## Overview
1010

11-
Testhis provides RStudio addins for common package development tasks:
11+
Testhis provides utility functions and RStudio addins for common package
12+
development tasks:
1213

1314
* `test_this()`: Run tests associated with the currently open R script file.
1415
* `lest_this()`: "Load and test"; As above, but call `devtools::load_all()` first

cran-comments.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ This is a new release, so there are no reverse dependencies.
1414

1515
## Notes
1616

17-
Most functions in this package modify the file system or are designed to be
18-
run interactively. That is why most code examples in the documentation are
19-
wrapped in `\dontrun{}`.
17+
* Most functions in this package modify the file system or are designed to be
18+
run interactively. That is why most code examples in the documentation are
19+
wrapped in `\dontrun{}`.
20+
* Removed all `:::` calls from the original submission.
2021

2122
---

vignettes/testthis.Rmd

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,18 @@ library(rstudioapi)
2323

2424
## Overview
2525

26-
Testthis provides tools to make unit testing in R more comfortable. It is
26+
Testthis contains tools to make unit testing in R more comfortable. It is
2727
designed to complement the packages **testthat**, **devtools** and **usethis**.
2828

2929

3030

31-
3231
## RStudio addins
3332

34-
Provides RStudio addins for common tasks, that can also be assigned to hotkeys.
35-
I recommend assigning `ctrl+alt+Insert`, `ctrl+alt+Pos1` and `ctrl+alt+PageUp`
36-
to the following functions (under *Tools/Modify Keyboard Shortcuts*):
33+
Testthis provides RStudio addins for common tasks. These can be called like
34+
normal R function, but it is also possible to assigned to hotkeys to them in
35+
RStudio (*Tools/Modify Keyboard Shortcuts*). I recommend assigning
36+
`ctrl+alt+Insert`, `ctrl+alt+Pos1` and `ctrl+alt+PageUp` to the following
37+
functions:
3738

3839
* `test_this()`: Run tests associated with the currently open R script file.
3940
* `lest_this()`: "Load and test"; As above, but call `devtools::load_all()` first
@@ -46,15 +47,15 @@ to the following functions (under *Tools/Modify Keyboard Shortcuts*):
4647
The functions above assume that if the current filename is `currentfile.R`,
4748
the associated test file is `/tests/testthat/test_currentfile.R`. If you want
4849
to modify this behaviour you can put the tag `#* @testfile anotherfile` anywhere
49-
in your code, usually the top or bottom of your .R file. Each R script can only
50+
in your code, usually the top or bottom of your `.R` file. Each R script can only
5051
have a single associated testfile.
5152

5253
The following example will associate the file `/tests/testthat/other_test_file.R`
5354
instead of `/tests/testthat/test_open_testfile.R` with `R/open_testfile`:
5455
```{r eval = FALSE}
5556
# file R/open_testfile.R
56-
#* @testfile other_testfile
5757
58+
#* @testfile other_testfile
5859
open_testfile <- function(){
5960
fname <- get_testfile_name()
6061

0 commit comments

Comments
 (0)