Hi,
thanks for maintaining stringr!
linux-gnu, R 4.5.3, stringr 1.6.0, testthat 3.3.2
When executing testthat::test_package(stringr), the following test failure occurs:
══ Failed tests ════════════════════════════════════════════════════════════════
── Failure ('test-sub.R:111:3'): bad vectorisation gives informative error ─────
Snapshot of code has changed:
old[2:10] vs new[2:10]
str_sub(x, 1:2, 1:3)
Condition
Error in `str_sub()`:
- ! Can't recycle `string` (size 2) to match `end` (size 3).
+ ! Can't recycle `start` (size 2) to match `end` (size 3).
Code
str_sub(x, 1:2, 1:2) <- 1:3
Condition
Error in `str_sub<-`:
- ! Can't recycle `string` (size 2) to match `value` (size 3).
+ ! Can't recycle `start` (size 2) to match `value` (size 3).
The test code in test-sub is:
test_that("bad vectorisation gives informative error", {
x <- "a"
expect_snapshot(error = TRUE, {
str_sub(x, 1:2, 1:3)
str_sub(x, 1:2, 1:2) <- 1:3
})
})
The snapshot test fails because it expects the error (in both cases) to be (specified in tests/testthat/_snaps/sub.md):
Error in `str_sub()`:
! Can't recycle `string` (size 2) to match `end` (size 3).
... which would occur if string (i.e., x in the test code) was of size 2, but the error really is (in both cases):
str_sub(x, 1:2, 1:3)
Error in `str_sub()`:
! Can't recycle `start` (size 2) to match `end` (size 3).
This seems like a typo in the snapshot file.
Hi,
thanks for maintaining stringr!
linux-gnu, R 4.5.3, stringr 1.6.0, testthat 3.3.2
When executing
testthat::test_package(stringr), the following test failure occurs:The test code in
test-subis:The snapshot test fails because it expects the error (in both cases) to be (specified in
tests/testthat/_snaps/sub.md):... which would occur if
string(i.e.,xin the test code) was of size 2, but the error really is (in both cases):This seems like a typo in the snapshot file.