[R-pkg-devel] testing coercion

Kevin Coombes kevin@r@coombe@ @ending from gm@il@com
Thu Dec 6 16:59:12 CET 2018


A package I recently submitted to CRAN includes an S4 class that defines a
method to coerce from that class to a numeric vector, basically through

>  setAs("myClass", "numeric", function(from) from using psi)

Being perhaps overly compulsive about trying to test everything while
documenting behavior, my accompanying test script includes these lines:

> try( as.numeric(wv) )            # should fail
> canCoerce(wv, "numeric")   # returns TRUE
> canCoerce(wv, "double")     # gets a complaint from CRAN incoming pretest

The complaint on the last line arises because
+ in the current version of R, the answer is FALSE
+ in the development version of R, the answer is TRUE
The change is (probably) documented on the R-devel daily news from 04 Sept
2018, which lists

Bug Fix:  as(1L, "double") now does coerce (PR#17457)

So, here's my question. Do I remove this test (and thus lose my
documentation of how the method behaves) in order to get the incoming
precheck to stop whinging? Or do I tell the CRAN maintainers to not worry
about the test changing, since it's due to a core bug fix, and promise to
change my saved test results when the devel version becomes current? (Even
though the fixed results will then show up as wrong in the "oldrel" tests.)


	[[alternative HTML version deleted]]

More information about the R-package-devel mailing list