augustoasilva commented on a change in pull request #11049:
URL: https://github.com/apache/arrow/pull/11049#discussion_r748171799



##########
File path: cpp/src/gandiva/precompiled/string_ops_test.cc
##########
@@ -912,6 +912,33 @@ TEST(TestStringOps, TestReverse) {
   ctx.Reset();
 }
 
+TEST(TestStringOps, TestQuote) {
+  gandiva::ExecutionContext ctx;
+  uint64_t ctx_ptr = reinterpret_cast<gdv_int64>(&ctx);
+  gdv_int32 out_len = 0;
+  const char* out_str;
+
+  out_str = quote_utf8(ctx_ptr, "dont", 4, &out_len);
+  EXPECT_EQ(std::string(out_str, out_len), "\'dont\'");
+  EXPECT_FALSE(ctx.has_error());
+
+  out_str = quote_utf8(ctx_ptr, "abc", 3, &out_len);
+  EXPECT_EQ(std::string(out_str, out_len), "\'abc\'");
+  EXPECT_FALSE(ctx.has_error());
+
+  out_str = quote_utf8(ctx_ptr, "don't", 5, &out_len);
+  EXPECT_EQ(std::string(out_str, out_len), "\'don\\'t\'");
+  EXPECT_FALSE(ctx.has_error());
+
+  out_str = quote_utf8(ctx_ptr, "", 0, &out_len);
+  EXPECT_EQ(std::string(out_str, out_len), "");
+  EXPECT_FALSE(ctx.has_error());
+
+  out_str = quote_utf8(ctx_ptr, "'", 1, &out_len);

Review comment:
       Added a test with more quotes




-- 
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: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to