Skip to content

Commit

Permalink
Updated vignettes (programming strategy and unit test guide) to speci…
Browse files Browse the repository at this point in the history
…fy library(tibble) and tribble() rather than tibble::tribble().
  • Loading branch information
esimms999-gsk committed Aug 29, 2022
1 parent 69f3025 commit dd3176b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
5 changes: 3 additions & 2 deletions vignettes/programming_strategy.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,9 @@ An example is given below:
#' @examples
#' library(lubridate)
#' library(dplyr)
#' library(tibble)
#'
#' datain <- tibble::tribble(
#' datain <- tribble(
#' ~TRTSDTM, ~ASTDTM, ~AENDT,
#' "2014-01-17T23:59:59", "2014-01-18T13:09:O9", "2014-01-20"
#' ) %>%
Expand Down Expand Up @@ -329,7 +330,7 @@ Any newly added variable(-s) should be mentioned here.
* `@examples`: A fully self-contained example of how to use the function.
Self-contained means that, if this code is executed in a new R session, it will run without errors.
That means any packages need to be loaded with `library()` and any datasets needed either to be created directly inside the example code or loaded using `data()`.
If a dataset is created in the example, it should be done so using the function `tibble::tribble()`.
If a dataset is created in the example, it should be done so using the function `tribble()` (specify `library(tibble)` before calling this function).
Make sure to align columns as this ensures quick code readability.

Copying descriptions should be avoided as it makes the documentation hard to
Expand Down
10 changes: 7 additions & 3 deletions vignettes/unit_test_guidance.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,9 @@ the testing framework used is testthat and has the following format :

```
test_that("<function_name> Test 1: <Explanation of the test>", {
input <- tibble::tribble(
library(tibble)
input <- tribble(
~inputvar1, ~inputvar2, ...
<Add Test Data Scenarios>
...
Expand All @@ -158,7 +160,9 @@ Open the newly created file "test-all_funcs.R" and use the following format:

```
test_that("my_new_func Test 1: <Explanation of the test>", {
input <- tibble::tribble(
library(tibble)
input <- tribble(
~inputvar1, ~inputvar2, ...
<Add Test Data Scenarios>
...
Expand All @@ -177,7 +181,7 @@ The input and expected output for the unit tests must follow the following rules
* Values should be hard-coded whenever possible.
* If values need to be derived, only unit tested functions can be used.

If a dataset needs to be created for testing purpose, it should be done so using the function `tibble::tribble()`.
If a dataset needs to be created for testing purpose, it should be done so using the function `tribble()` (specify `library(tibble)` before calling this function).
Make sure to align columns as well. This ensures quick code readability.

Ensure you give a meaningful explanation of the test in the testthat call, as
Expand Down

0 comments on commit dd3176b

Please sign in to comment.