ianmcook commented on a change in pull request #10190:
URL: https://github.com/apache/arrow/pull/10190#discussion_r622515372



##########
File path: r/tests/testthat/test-compute-string-split.R
##########
@@ -0,0 +1,32 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+test_str <-c("foobar, foo, bar", "baz, qux, quux.")
+
+test_that("strsplit for Array and ChunkedArray ", {
+  expect_vector_equal(strsplit(input, split = ","), test_str, ignore_attr = 
TRUE)
+})
+
+test_that("strsplit for Scalar", {
+  test_scalar <- Scalar$create(test_str[1])
+  expect_equal(
+    strsplit(test_scalar, split = ","),
+    Scalar$create(list(c("foobar", " foo", " bar")))
+  )
+})

Review comment:
       Given the discussion above about masking, I think you could modify the 
tests here to just use `call_function("split_pattern", ...)` instead of 
`strsplit()`. That provides a direct test that the code you added in 
`compute.cpp` is working as expected. You could also test `max_splits` and 
`reverse` that way.
   
   And to test `strsplit()` inside dplyr verbs, you can add additional test 
code in `test-dplyr-string-functions.R`




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to