Testing warnings in R by comparing strings (best idea?) -
i'm working on r package , need writing r test functions meant check whether correct warning being thrown on c-side code , caught on r side. let me give background on i'm working on exactly: most of i'm writing done on c side. in addition, have if-statement type macro in c allows coder pass warning r in form of string. basic premise if(statement_true) pass_warning_to_r("warning string pass"). i'd test whether these warnings being thrown when expect/need them writing r file uses trycatch blocks. so far i've written similar this: counter <- 0 trycatch({ function_im_testing() }, warning = function(war) { # check if warning expected , if increment counter if(tostring(war)=="the warning i'm expecting/testing for"){ print(tostring(war)) counter <- counter + 1 } }, error = function(err) { print(tostring(err)) }, = { print("leaving trycatch") }) # stop if 3 warnings expected aren...