Skip to content

Commit 53b0ee8

Browse files
expect_failure() -> expect_snapshot_failure()
1 parent 150425b commit 53b0ee8

File tree

2 files changed

+25
-5
lines changed

2 files changed

+25
-5
lines changed

tests/testthat/_snaps/expect-shape.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
1+
# shape computed correctly
2+
3+
`object` has length 1, not length 2.
4+
5+
---
6+
7+
matrix(nrow = 6, ncol = 3) has shape (6, 3), not (6, 2).
8+
9+
---
10+
11+
matrix(nrow = 6, ncol = 3) has shape (6, 3), not (7, 3).
12+
13+
---
14+
15+
matrix(nrow = 5, ncol = 5) has 5 rows, not 6.
16+
17+
---
18+
19+
matrix(nrow = 5, ncol = 5) has 5 columns, not 7.
20+
121
# at least one argument is required
222

323
Code

tests/testthat/test-expect-shape.R

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
test_that("shape computed correctly", {
22
# equivalent to expect_length
33
expect_success(expect_shape(1, length = 1))
4-
expect_failure(expect_shape(1, length = 2), "has length 1, not length 2.")
4+
expect_snapshot_failure(expect_shape(1, length = 2))
55
expect_success(expect_shape(1:10, length = 10))
66
expect_success(expect_shape(letters[1:5], length = 5))
77

88
# testing dim()
99
expect_success(expect_shape(matrix(nrow = 5, ncol = 4), dim = c(5L, 4L)))
10-
expect_failure(expect_shape(matrix(nrow = 6, ncol = 3), dim = c(6L, 2L)))
11-
expect_failure(expect_shape(matrix(nrow = 6, ncol = 3), dim = c(7L, 3L)))
10+
expect_snapshot_failure(expect_shape(matrix(nrow = 6, ncol = 3), dim = c(6L, 2L)))
11+
expect_snapshot_failure(expect_shape(matrix(nrow = 6, ncol = 3), dim = c(7L, 3L)))
1212
expect_success(expect_shape(data.frame(1:10, 11:20), dim = c(10, 2)))
1313
expect_success(expect_shape(array(dim = 1:3), dim = 1:3))
1414

1515
# testing nrow=
1616
expect_success(expect_shape(matrix(nrow = 5, ncol = 4), nrow = 5L))
17-
expect_failure(expect_shape(matrix(nrow = 5, ncol = 5), nrow = 6L))
17+
expect_snapshot_failure(expect_shape(matrix(nrow = 5, ncol = 5), nrow = 6L))
1818
expect_success(expect_shape(data.frame(1:10, 11:20), nrow = 10L))
1919

2020
# testing ncol=
2121
expect_success(expect_shape(matrix(nrow = 5, ncol = 4), ncol = 4L))
22-
expect_failure(expect_shape(matrix(nrow = 5, ncol = 5), ncol = 7L))
22+
expect_snapshot_failure(expect_shape(matrix(nrow = 5, ncol = 5), ncol = 7L))
2323
expect_success(expect_shape(data.frame(1:10, 11:20), ncol = 2L))
2424
})
2525

0 commit comments

Comments
 (0)