Jefffrey commented on code in PR #9221:
URL: https://github.com/apache/arrow-rs/pull/9221#discussion_r2735246111


##########
arrow-cast/src/pretty.rs:
##########
@@ -1776,4 +1776,128 @@ mod tests {
             "Invalid argument error: Expected the same number of columns in a 
record batch (1) as the number of fields (2) in the schema"
         );
     }
+
+    #[test]
+    fn test_quoted_strings() {
+        let schema = Arc::new(Schema::new(vec![Field::new(
+            "strings",
+            DataType::Utf8,
+            true,
+        )]));
+
+        let string_array = StringArray::from(vec![
+            Some("hello"),
+            Some("world"),
+            Some(""),
+            Some("tab\there"),
+            Some("newline\ntest"),
+            Some("quote\"test"),
+            Some("backslash\\test"),
+            None,
+        ]);
+
+        let batch = RecordBatch::try_new(schema.clone(), 
vec![Arc::new(string_array)]).unwrap();
+
+        let options_none = FormatOptions::new().with_null("NULL");
+        let table = 
pretty_format_batches_with_options(std::slice::from_ref(&batch), &options_none)
+            .unwrap()
+            .to_string();
+
+        assert!(table.contains("| hello"));

Review Comment:
   It would be nice if we could introduce insta, whether in this PR or in 
followups; I would be happy to review such PRs. It looks like we do have insta 
in arrow-schema too: https://github.com/apache/arrow-rs/pull/8424



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