You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/05/02 13:40:27 UTC

[GitHub] [arrow-datafusion] WinkerDu opened a new issue, #2412: Make expected result string in unit tests more readable

WinkerDu opened a new issue, #2412:
URL: https://github.com/apache/arrow-datafusion/issues/2412

   Some unit tests in DataFusion organize expected result string vector in one line, like `sql::union::union_distinct` do
   ```
   #[tokio::test]
   async fn union_distinct() -> Result<()> {
       let ctx = SessionContext::new();
       let sql = "SELECT 1 as x UNION SELECT 1 as x";
       let actual = execute_to_batches(&ctx, sql).await;
       let expected = vec!["+---+", "| x |", "+---+", "| 1 |", "+---+"];
       assert_batches_eq!(expected, &actual);
       Ok(())
   }
   ```
   We can separate the expected result string vector into multiple line to make it more readable and easier to follow, by adding a `#[rustfmt::skip]` tag to skip fmt check as following code
   ```
   #[tokio::test]
   async fn union_distinct() -> Result<()> {
       let ctx = SessionContext::new();
       let sql = "SELECT 1 as x UNION SELECT 1 as x";
       let actual = execute_to_batches(&ctx, sql).await;
       #[rustfmt::skip]
       let expected = vec![
           "+---+",
           "| x |",
           "+---+",
           "| 1 |",
           "+---+"
       ];
       assert_batches_eq!(expected, &actual);
       Ok(())
   }
   ```


-- 
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-unsubscribe@arrow.apache.org.apache.org

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


[GitHub] [arrow-datafusion] andygrove closed issue #2412: Make expected result string in unit tests more readable

Posted by GitBox <gi...@apache.org>.
andygrove closed issue #2412: Make expected result string in unit tests more readable
URL: https://github.com/apache/arrow-datafusion/issues/2412


-- 
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-unsubscribe@arrow.apache.org

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