@@ -67,12 +67,12 @@ test_that("fortify.default can handle healthy data-frame-like objects", {
6767
6868 # Not even data-frame-like
6969
70- expect_error (fortify(X ))
71- expect_error (fortify(array (1 : 60 , 5 : 3 )))
70+ expect_snapshot (fortify(X ), error = TRUE )
71+ expect_snapshot (fortify(array (1 : 60 , 5 : 3 )), error = TRUE )
7272
7373 # Unhealthy data-frame-like (matrix with no colnames)
7474
75- expect_error (fortify(cbind(X , Y , Z , deparse.level = 0 )))
75+ expect_snapshot (fortify(cbind(X , Y , Z , deparse.level = 0 )), error = TRUE )
7676
7777 # Healthy data-frame-like (matrix with colnames)
7878
@@ -102,23 +102,23 @@ test_that("fortify.default can handle healthy data-frame-like objects", {
102102
103103 dim.foo <- function (x ) stop(" oops!" )
104104 registerS3method(" dim" , " foo" , dim.foo )
105- expect_error (fortify(object ))
105+ expect_snapshot (fortify(object ), error = TRUE )
106106
107107 dim.foo <- function (x ) c(length(x ), 2 )
108108 registerS3method(" dim" , " foo" , dim.foo )
109- expect_error (fortify(object ))
109+ expect_snapshot (fortify(object ), error = TRUE )
110110
111111 dim.foo <- function (x ) 5 : 2
112112 registerS3method(" dim" , " foo" , dim.foo )
113- expect_error (fortify(object ))
113+ expect_snapshot (fortify(object ), error = TRUE )
114114
115115 dim.foo <- function (x ) c(length(x ), NA_integer_ )
116116 registerS3method(" dim" , " foo" , dim.foo )
117- expect_error (fortify(object ))
117+ expect_snapshot (fortify(object ), error = TRUE )
118118
119119 dim.foo <- function (x ) c(length(x ), - 5L )
120120 registerS3method(" dim" , " foo" , dim.foo )
121- expect_error (fortify(object ))
121+ expect_snapshot (fortify(object ), error = TRUE )
122122
123123 # Repair dim(<foo>)
124124
@@ -129,18 +129,18 @@ test_that("fortify.default can handle healthy data-frame-like objects", {
129129
130130 dimnames.foo <- function (x ) list () # this breaks colnames(<foo>)
131131 registerS3method(" dimnames" , " foo" , dimnames.foo )
132- expect_error (fortify(object ))
132+ expect_snapshot (fortify(object ), error = TRUE )
133133
134134 dimnames.foo <- function (x ) list (format(seq_along(x )), toupper )
135135 registerS3method(" dimnames" , " foo" , dimnames.foo )
136- expect_error (fortify(object ))
136+ expect_snapshot (fortify(object ), error = TRUE )
137137
138138 # Rejected by fortify.default() because behaviors of dim() and colnames()
139139 # don't align
140140
141141 dimnames.foo <- function (x ) list (NULL , c(" X1" , " X2" , " X3" ))
142142 registerS3method(" dimnames" , " foo" , dimnames.foo )
143- expect_error (fortify(object ))
143+ expect_snapshot (fortify(object ), error = TRUE )
144144
145145 # Repair colnames(<foo>)
146146
@@ -151,20 +151,21 @@ test_that("fortify.default can handle healthy data-frame-like objects", {
151151
152152 as.data.frame.foo <- function (x , row.names = NULL , ... ) stop(" oops!" )
153153 registerS3method(" as.data.frame" , " foo" , as.data.frame.foo )
154- expect_error (fortify(object ))
154+ expect_snapshot (fortify(object ), error = TRUE )
155155
156156 as.data.frame.foo <- function (x , row.names = NULL , ... ) " whatever"
157157 registerS3method(" as.data.frame" , " foo" , as.data.frame.foo )
158- expect_error (fortify(object ))
158+ expect_snapshot (fortify(object ), error = TRUE )
159159
160160 as.data.frame.foo <- function (x , row.names = NULL , ... ) data.frame ()
161161 registerS3method(" as.data.frame" , " foo" , as.data.frame.foo )
162- expect_error(fortify(object ))
162+
163+ expect_snapshot(fortify(object ), error = TRUE )
163164
164165 as.data.frame.foo <- function (x , row.names = NULL , ... ) {
165166 key <- if (is.null(names(x ))) rownames(x ) else names(x )
166167 data.frame (oops = key , value = unname(unclass(x )))
167168 }
168169 registerS3method(" as.data.frame" , " foo" , as.data.frame.foo )
169- expect_error (fortify(object ))
170+ expect_snapshot (fortify(object ), error = TRUE )
170171})
0 commit comments