[R-pkg-devel] Another CRAN-only bug

Iñaki Ucar |uc@r @end|ng |rom |edor@project@org
Thu Jun 13 11:54:17 CEST 2019


On Thu, 13 Jun 2019 at 10:41, David Hugh-Jones <davidhughjones using gmail.com> wrote:
>
>  Well, the test that fails is this one:
> https://win-builder.r-project.org/incoming_pretest/huxtable_4.6.0_20190612_195453/Windows/examples_and_tests/tests_x64/testthat/test-openxlsx.R
>
>
> The last line fails here:
>
>   hx <- huxtable(a = 1:2 + 0.5, b = -1:-2 + 0.5, d = letters[1:2],
> add_colnames = TRUE)
>   wb <- as_Workbook(hx)
>   expect_error(openxlsx::saveWorkbook(wb, file = "test-xlsx.xlsx",
> overwrite = TRUE),
>         regexp = NA) # openxlsx may emit messages
>   dfr <- openxlsx::read.xlsx("test-xlsx.xlsx")
>   expect_equivalent(class(dfr[[1]]), "numeric")
>   expect_equivalent(class(dfr[[2]]), "numeric")
>   expect_equivalent(class(dfr[[3]]), "character")
>   expect_equal(dfr[[1]], 1:2 + 0.5)
>
> Putting to one side the issue of testthat’s putative faults, I am happy to
> debug this myself, but how can I reproduce the platform to do it on?

According to the errors,

-- 1. Failure: Data written in appropriate format (@test-openxlsx.R#107)  ------
dfr[[1]] not equal to 1:2 + 0.5.
2/2 mismatches (average diff: 0.5)
[1] 1 - 1.5 == -0.5
[2] 2 - 2.5 == -0.5

-- 2. Failure: Data written in appropriate format (@test-openxlsx.R#108)  ------
dfr[[2]] not equal to -1:-2 + 0.5.
2/2 mismatches (average diff: 0.5)
[1]  0 - -0.5 == 0.5
[2] -1 - -1.5 == 0.5

your values are being casted to integers at some point. There are 4
places in the test where this may have happened:

- huxtable()
- as_Workbook()
- openxlsx::saveWorkbook()
- openxlsx::read.xlsx()

Iñaki



More information about the R-package-devel mailing list