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

Update unit test template for usethis::use_test #2082

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
11 changes: 9 additions & 2 deletions inst/templates/test-example-2.1.R
Original file line number Diff line number Diff line change
@@ -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)
})
Loading