r devtools test() errors but testthat test_file() works
问题 I have a function in a package I'm building that assigns a hex-code to the global environment for use by analysts... optiplum<-function(){ assign( x="optiplum", value=rgb(red=129,green=61,blue=114, maxColorValue = 255), envir=.GlobalEnv) } My unit test code is: test_that("optiplum - produces the correct hex code",{ optiplum() expect_true(identical(optiplum,"#813D72")) }) When I run the code manually, there isn't an error: > str(optiplum) chr "#813D72" > str("#813D72") chr "#813D72" >