diff --git a/NEWS.md b/NEWS.md index b1c58551b..95daa0bc5 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,6 @@ # usethis (development version) +* `use_test()` now creates a unit test with the ['#Arrange, #Act, #Assert'](https://xp123.com/3a-arrange-act-assert/) pattern. * `use_tidy_upkeep_issue()` now records the year it is being run in the `Config/usethis/upkeep` field in DESCRIPTION. If this value exists it is furthermore used to filter the checklist when making the issue. diff --git a/inst/templates/test-example-2.1.R b/inst/templates/test-example-2.1.R index 8849056e2..dd307df7d 100644 --- a/inst/templates/test-example-2.1.R +++ b/inst/templates/test-example-2.1.R @@ -1,3 +1,10 @@ -test_that("multiplication works", { - expect_equal(2 * 2, 4) +test_that("is.numeric returns TRUE if all elements of a vector are integers", { + # Arrange + x <- c(1L, 2L, 3L) + + # Act + result <- is.numeric(x) + + # Assert + expect_true(result) })