This is an automated email from the ASF dual-hosted git repository.
thisisnic pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/main by this push:
new 49ac0f2d2d GH-46916: [R] Test for negative fractional dates fails on
older R versions due to change in base R as.Date() (#46917)
49ac0f2d2d is described below
commit 49ac0f2d2d0c40eda79b87eab77389ed498cee0b
Author: Nic Crane <[email protected]>
AuthorDate: Tue Jul 1 06:44:37 2025 +0100
GH-46916: [R] Test for negative fractional dates fails on older R versions
due to change in base R as.Date() (#46917)
### Rationale for this change
Test in #46873 fails on older R versions
### What changes are included in this PR?
Update test to be compatible with R versions
### Are these changes tested?
Yeah
### Are there any user-facing changes?
Nah
* GitHub Issue: #46916
Authored-by: Nic Crane <[email protected]>
Signed-off-by: Nic Crane <[email protected]>
---
r/tests/testthat/test-Array.R | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/r/tests/testthat/test-Array.R b/r/tests/testthat/test-Array.R
index 7bde0e544d..8c47715495 100644
--- a/r/tests/testthat/test-Array.R
+++ b/r/tests/testthat/test-Array.R
@@ -1275,7 +1275,7 @@ test_that("concat_arrays works", {
concat_int <- concat_arrays(arrow_array(1:3), arrow_array(4:5))
expect_true(concat_int$type == int32())
- expect_equal(concat_int, arrow_array(1:5))
+ expect_equal(concat_int, arrow_array(1:5))
concat_int64 <- concat_arrays(
arrow_array(1:3),
@@ -1414,7 +1414,8 @@ test_that("Can convert R integer/double to decimal
(ARROW-11631)", {
})
test_that("Array handles negative fractional dates correctly (GH-46873)", {
- d <- as.Date(-0.1)
+ # `origin` must be specified for compatibility with R versions < 4.2.0
+ d <- as.Date(-0.1, origin = "1970-01-01")
arr <- arrow_array(d)
- expect_equal(as.vector(arr), as.Date("1969-12-31"))
+ expect_equal(as.vector(arr), as.Date("1969-12-31", origin = "1970-01-01"))
})