Skip to content

Commit

Permalink
usethis::use_testthat(3)
Browse files Browse the repository at this point in the history
  • Loading branch information
gaborcsardi committed Nov 4, 2023
1 parent 8faba6b commit d24091a
Show file tree
Hide file tree
Showing 9 changed files with 10 additions and 23 deletions.
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ Depends:
Suggests:
codetools,
covr,
testthat
testthat (>= 3.0.0)
RoxygenNote: 7.2.3
Roxygen: list(markdown = TRUE)
Encoding: UTF-8
Config/Needs/website: tidyverse/tidytemplate
Config/testthat/edition: 3
8 changes: 8 additions & 0 deletions tests/testthat.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# This file is part of the standard setup for testthat.
# It is recommended that you do not modify it.
#
# Where should you do additional test configuration?
# Learn more about the roles of various files in:
# * https://r-pkgs.org/testing-design.html#sec-tests-files-overview
# * https://testthat.r-lib.org/articles/special-files.html

library(testthat)
library(prettyunits)

Expand Down
3 changes: 0 additions & 3 deletions tests/testthat/test-bytes.r
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@

context("Pretty bytes")

test_that("sizes.R is standalone", {
stenv <- environment(format_bytes$pretty_bytes)
objs <- ls(stenv, all.names = TRUE)
Expand Down
2 changes: 0 additions & 2 deletions tests/testthat/test-color.r
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
context("Pretty color")

test_that("pretty_color works", {
expect_equal(
pretty_color("black"),
Expand Down
7 changes: 0 additions & 7 deletions tests/testthat/test-ms.r
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@

context("Pretty milliseconds")

test_that("pretty_ms works", {

expect_equal(pretty_ms(0), '0ms')
Expand Down Expand Up @@ -36,8 +33,6 @@ test_that("pretty_ms handles vectors", {
expect_equal(pretty_ms(v), v2)
})

context("Pretty seconds")

test_that("pretty_sec works", {

expect_equal(pretty_sec(0 / 1000), '0ms')
Expand Down Expand Up @@ -73,8 +68,6 @@ test_that("pretty_sec handles vectors", {
expect_equal(pretty_sec(v), v2)
})

context("Pretty dt")

test_that("pretty_dt works", {

expect_equal(pretty_dt(as.difftime(units = "secs", 0 / 1000)), '0ms')
Expand Down
3 changes: 0 additions & 3 deletions tests/testthat/test-numbers.r
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@

context("Pretty numbers")

test_that("sizes.R is standalone", {
stenv <- environment(format_num$pretty_num)
objs <- ls(stenv, all.names = TRUE)
Expand Down
2 changes: 0 additions & 2 deletions tests/testthat/test-p-value.r
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
context("p-values")

test_that("p-values work", {
expect_equal(
pretty_p_value(c(1, 0, NA, 0.01, 0.0000001)),
Expand Down
2 changes: 0 additions & 2 deletions tests/testthat/test-rounding.r
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
context("Rounding to string values")

test_that("Rounding", {
expect_error(pretty_round(1, c(2, 3)),
regexp="digits must either be a scalar or the same length as x")
Expand Down
3 changes: 0 additions & 3 deletions tests/testthat/test-vague-dt.r
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@

context("Vague time intervals")

## Amount, unit, default result, short, terse
all_tests <- list(
list( 1, "secs", "moments ago", "<1 min", " 1s"),
Expand Down

0 comments on commit d24091a

Please sign in to comment.