Skip to content

Commit

Permalink
add basic test
Browse files Browse the repository at this point in the history
  • Loading branch information
teunbrand committed Jan 6, 2025
1 parent 28ca4f9 commit 43c10ee
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/testthat/_snaps/edition.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# basic edition infrastructure works as intended

Code
edition_deprecate(2025, what = "foo()")
Condition
Error:
! `foo()` was deprecated in ggplot2 edition 2025 and is now defunct.

---

Code
edition_require(2025, what = "foo()")
Condition
Error in `edition_require()`:
! foo() requires the 2025 edition of ggplot2.

10 changes: 10 additions & 0 deletions tests/testthat/test-edition.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
test_that("basic edition requirement and deprecation works as intended", {

local_edition(2025)
expect_snapshot(edition_deprecate(2025, what = "foo()"), error = TRUE)
expect_silent(edition_require(2025, what = "foo()"))

local_edition(2024)
expect_silent(edition_deprecate(2025, what = "foo()"))
expect_snapshot(edition_require(2025, what = "foo()"), error = TRUE)
})

0 comments on commit 43c10ee

Please sign in to comment.