implemented suggestions from Hadley regarding sys.source2() and .test_code()
fixed the R CMD check failures due to defining ref classes in the global env by defining those test-time classes inside functions with explicit where= envs