pachadotdev commented on a change in pull request #10624:
URL: https://github.com/apache/arrow/pull/10624#discussion_r668221668



##########
File path: r/tests/testthat/test-dplyr-string-functions.R
##########
@@ -868,42 +868,76 @@ test_that("str_like", {
 })
 
 test_that("str_pad", {
-  
+
   df <- tibble(x = c("Foo and bar", "baz and qux and quux"))
-  
+
   expect_dplyr_equal(
     input %>%
       mutate(x = str_pad(x, width = 31)) %>%
       collect(),
     df
   )
-  
+
   expect_dplyr_equal(
     input %>%
       mutate(x = str_pad(x, width = 30, side = "right")) %>%
       collect(),
     df
   )
-  
+
   expect_dplyr_equal(
     input %>%
       mutate(x = str_pad(x, width = 31, side = "left", pad = "+")) %>%
       collect(),
     df
   )
-  
+
   expect_dplyr_equal(
     input %>%
       mutate(x = str_pad(x, width = 10, side = "left", pad = "+")) %>%
       collect(),
     df
   )
-  
+
   expect_dplyr_equal(
     input %>%
       mutate(x = str_pad(x, width = 31, side = "both")) %>%
       collect(),
     df
   )
-  
+})
+
+test_that("substr, substring, str_sub", {
+
+  df <- tibble(x1 = "Apache Arrow")
+
+  expect_dplyr_equal(
+    input %>%
+      mutate(
+        x2 = substr(x1, 1, 6), # Apache
+        x3 = substr(x1, 8, 12) # Arrow
+      ) %>%
+      collect(),
+    df
+  )
+
+  expect_dplyr_equal(
+    input %>%
+      mutate(
+        x2 = substring(x1, 1, 6), # Apache
+        x3 = substring(x1, 8, 12) # Arrow
+      ) %>%
+      collect(),
+    df
+  )
+
+  expect_dplyr_equal(
+    input %>%
+      mutate(
+        x2 = str_sub(x1, 1, 6), # Apache
+        x3 = str_sub(x1, 8, 12) # Arrow
+      ) %>%
+      collect(),
+    df
+  )
 })

Review comment:
       yes !! i have no idea what happened here, but i'll re-add or re-write 
those
   




-- 
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]


Reply via email to