Skip to content

Commit

Permalink
use snapshot test
Browse files Browse the repository at this point in the history
  • Loading branch information
teunbrand committed Oct 22, 2024
1 parent 2c8159a commit 615dfe6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions tests/testthat/_snaps/label-bytes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# errors if unknown unit

Code
label_bytes("unit")(0)
Condition
Error:
! `units` must be one of "kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB", "kiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", or "YiB", not "unit".

2 changes: 1 addition & 1 deletion tests/testthat/test-label-bytes.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ test_that("compatible with scale argument", {
})

test_that("errors if unknown unit", {
expect_error(label_bytes("unit")(0), "must be one of")
expect_snapshot(label_bytes("unit")(0), error = TRUE)
})

# deprecated interface ----------------------------------------------------
Expand Down

0 comments on commit 615dfe6

Please sign in to comment.