Skip to content

Commit 8a7d8c3

Browse files
committed
narrow gctorture scope in module regression test
1 parent 1e383a3 commit 8a7d8c3

1 file changed

Lines changed: 5 additions & 9 deletions

File tree

inst/tinytest/test_module.R

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -109,15 +109,11 @@ expect_equal( test_const( seq(0,10) ), 11L )
109109

110110
## mixed-voidness method overloads dispatch through class_::invoke(),
111111
## which must protect the freshly allocated method result while it
112-
## wraps it in the result list (#1493)
112+
## wraps it in the result list (#1493); under gctorture every
113+
## allocation triggers a collection, so a single call exercises the
114+
## unprotected window deterministically
113115
gadget <- new( ModuleGadget )
114-
ok <- TRUE
115116
gctorture(TRUE)
116-
for (i in 1:20) {
117-
if (!identical(gadget$value(), c(1, 2, 3))) {
118-
ok <- FALSE
119-
break
120-
}
121-
}
117+
res <- gadget$value()
122118
gctorture(FALSE)
123-
expect_true( ok )
119+
expect_identical( res, c(1, 2, 3) )

0 commit comments

Comments
 (0)