Skip to content

Commit bcc7295

Browse files
committed
Add string reverse functions and stringi to suggests
1 parent 00dfaf0 commit bcc7295

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

r/DESCRIPTION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ Suggests:
4848
pkgload,
4949
reticulate,
5050
rmarkdown,
51+
stringi,
5152
stringr,
5253
testthat,
5354
tibble,

r/R/expression.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929
# stringr spellings of those
3030
"str_length" = "utf8_length",
3131
"str_to_lower" = "utf8_lower",
32-
"str_to_upper" = "utf8_upper"
32+
"str_to_upper" = "utf8_upper",
33+
"str_reverse" = "utf8_reverse"
3334
# str_trim is defined in dplyr.R
3435
)
3536

r/tests/testthat/test-dplyr-string-functions.R

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ skip_if_not_available("utf8proc")
2020

2121
library(dplyr)
2222
library(stringr)
23+
library(stringi)
2324

2425
test_that("paste, paste0, and str_c", {
2526
df <- tibble(
@@ -725,26 +726,24 @@ test_that("errors in strptime", {
725726
)
726727
})
727728

728-
test_that("arrow_utf8_reverse and arrow_ascii_reverse functions", {
729+
test_that("stri_reverse and arrow_ascii_reverse functions", {
729730

730731
df_ascii <- tibble(x = c("Foo\nand bar", "baz\tand qux and quux"))
731732

732733
df_utf8 <- tibble(x = c("Foo\u00A0\u0061nd\u00A0bar", "\u0062az\u00A0and\u00A0qux\u3000and\u00A0quux"))
733734

734-
expect_equivalent(
735-
df_ascii %>%
736-
Table$create() %>%
737-
mutate(x = arrow_utf8_reverse(x)) %>%
735+
expect_dplyr_equal(
736+
input %>%
737+
mutate(x = stri_reverse(x)) %>%
738738
collect(),
739-
tibble(x = c("rab dna\nooF", "xuuq dna xuq dna\tzab"))
739+
df_utf8
740740
)
741741

742-
expect_equivalent(
743-
df_utf8 %>%
744-
Table$create() %>%
745-
mutate(x = arrow_utf8_reverse(x)) %>%
742+
expect_dplyr_equal(
743+
input %>%
744+
mutate(x = stri_reverse(x)) %>%
746745
collect(),
747-
tibble(x = c("rab\u00A0dn\u0061\u00A0ooF", "xuuq\u00A0dna\u3000xuq\u00A0dna\u00A0za\u0062"))
746+
df_ascii
748747
)
749748

750749
expect_equivalent(

0 commit comments

Comments
 (0)