You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While trying to implement #17688, I noticed that example(stopifnot) does not run to completion - it stops after the first example of stopping. There are more examples after that which don't get run (and the handler is overridden), so this might be unintentional?
OTOH, in R's make check-devel it runs completely through as desired.
Also, if the examples are run by line, interactively (most efficiently in ESS),
it works fine too.
It also works if you send the whole examples "region" to R (again, in ESS), or I'm sure if you cut'n'paste the whole example section into a standard R console.
("standard" not being RStudio; I did not try there).
Yes, this is "unadvertent" in the sense that this was not planned;
OTOH, in order for these to work (notably in R's automated checks, see above), it is necessary to disable the handler
op <- options(error = expression(NULL))
# "disabling stop(.)" << Use with CARE! >>
and the comment does warn.
If somebody can think of a smart trick to also have this work with example(stopifnot) I'd be grateful and probably gladly use that (or tell the user in a comment on how to use it.
It's tricky: example() call source(*, echo=TRUE) and source() does quite a bit of fiddling in the 'echo=TRUE' case including using tryCatch(...).
So that is "the explanation" mostly.
I'm setting this to 'ASSIGNED' now, but will probably not spend time trying to solve it. In a year or so, either somebody will have provided a trick / patch for this, or I will add a comment at the beginning of the 'examples' section that they only run through in BATCH mode or fully interactively, but not when run via example().
One more thought: To "fix" this I think means to improve the example() function, and do that most probably by making source() more flexible: possibly by adding yet another (optional, probably logical) argument to source() which when set to TRUE would do the error handling slightly differently within source().
While trying to implement #17688, I noticed that example(stopifnot) does not run to completion - it stops after the first example of stopping. There are more examples after that which don't get run (and the handler is overridden), so this might be unintentional?
METADATA
The text was updated successfully, but these errors were encountered: