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
{{ message }}
This repository has been archived by the owner on Dec 6, 2022. It is now read-only.
@MKLau, I like these tests, and I like that they are specific and targeted. I strongly suggest a couple more tests like them for a couple variables in long_script.R.
I also think it is important to compare the actual values of the results you get from actually running the scripts. A cleaned script ultimately needs to produce the same output you get from the original. So for this test, you could
Run source(simple.script, local = some_new_environment) and inspect some_new_environment to get one value of out.
Similarly, get another value of out from the cleaned script.
Compare the two values of out using expect_equal().
The text was updated successfully, but these errors were encountered:
What about the ability of cleaned scripts to exclude variables? You could test that fit.xx, fit.sqrt.A, and fit.anova are in env.long but not the other environments.
I think it makes sense to keep all the variables in the same test, but maybe you could condense it down to a loop that calls a function. 3. When you get variables from the environments, get() with inherits = FALSE prevents R from looking in the parent environment for the object, and I think it would add a little safety here.
tempfile()s are more convenient than creating explicitly named scripts and removing them at the end.
withr::with_seed() sets the seed for a chunk of code and restores the original seed afterwards. It could be more convenient and maybe safer.
From @wlandau:
The text was updated successfully, but these errors were encountered: