Skip to content

Commit 028b43b

Browse files
committed
add test
1 parent c716904 commit 028b43b

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

tests/testthat/_snaps/ggproto.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,7 @@
1010

1111
`_inherit` must be a <ggproto> object, not a <data.frame> object.
1212

13+
# circular definitions are protested
14+
15+
<Circular> cannot have a circular definition.
16+

tests/testthat/test-ggproto.R

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ test_that("construction checks input", {
1111
expect_snapshot_error(ggproto("Test", mtcars, a = function(self, a) a))
1212
})
1313

14+
test_that("circular definitions are protested", {
15+
circular <- ggproto("Circular")
16+
circular <- ggproto(NULL, circular)
17+
expect_snapshot_error(print(circular))
18+
})
19+
1420
test_that("all ggproto methods start with `{` (#6459)", {
1521

1622
ggprotos <- Filter(

0 commit comments

Comments
 (0)