ianmcook commented on a change in pull request #11023:
URL: https://github.com/apache/arrow/pull/11023#discussion_r741576370
##########
File path: r/tests/testthat/test-dplyr-funcs-string.R
##########
@@ -467,6 +467,18 @@ test_that("strsplit and str_split", {
)
})
+test_that("strrep", {
+ df <- tibble(x = c("foo1", " \tB a R\n", "!apACHe aRroW!"))
+ for (times in 0:8L) {
+ compare_dplyr_binding(
+ .input %>%
+ mutate(x = strrep(x, times)) %>%
+ collect(),
+ df
+ )
+ }
+})
+
Review comment:
Adds a test for the `str_dup()` binding I suggested above. Also FYI you
don't need the `L` after `8` because the `:` operator in R always creates
integer vectors when its operands are whole numbers.
```suggestion
test_that("strrep, str_dup", {
df <- tibble(x = c("foo1", " \tB a R\n", "!apACHe aRroW!"))
for (times in 0:8) {
compare_dplyr_binding(
.input %>%
mutate(x = strrep(x, times)) %>%
collect(),
df
)
compare_dplyr_binding(
.input %>%
mutate(x = str_dup(x, times)) %>%
collect(),
df
)
}
})
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]