| 
1 | 1 | test_that("shape computed correctly", {  | 
2 | 2 |   # equivalent to expect_length  | 
3 | 3 |   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))  | 
5 | 5 |   expect_success(expect_shape(1:10, length = 10))  | 
6 | 6 |   expect_success(expect_shape(letters[1:5], length = 5))  | 
7 | 7 | 
 
  | 
8 | 8 |   # testing dim()  | 
9 | 9 |   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)))  | 
12 | 12 |   expect_success(expect_shape(data.frame(1:10, 11:20), dim = c(10, 2)))  | 
13 | 13 |   expect_success(expect_shape(array(dim = 1:3), dim = 1:3))  | 
14 | 14 | 
 
  | 
15 | 15 |   # testing nrow=  | 
16 | 16 |   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))  | 
18 | 18 |   expect_success(expect_shape(data.frame(1:10, 11:20), nrow = 10L))  | 
19 | 19 | 
 
  | 
20 | 20 |   # testing ncol=  | 
21 | 21 |   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))  | 
23 | 23 |   expect_success(expect_shape(data.frame(1:10, 11:20), ncol = 2L))  | 
24 | 24 | })  | 
25 | 25 | 
 
  | 
 | 
0 commit comments