[ 
https://issues.apache.org/jira/browse/ARROW-14458?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Dragoș Moldovan-Grünfeld updated ARROW-14458:
---------------------------------------------
    Description: 
Update (2022, January 20):
[Hadley's 
suggestion|https://github.com/r-lib/testthat/issues/1471#issuecomment-1005372257]
 would be to move away from the
{code:r}
expect_snapshot({
  (expect_error())
}) 
{code}
pattern and use one of 3 options:

 
 * If you want to inspect the error message, use {{{}expect_snapshot(error = 
TRUE){}}}.
 * If you want to check the class, use {{expect_error(class = )}}
 * If you want to expect the message and check the class, use 
{{{}expect_snapshot_error(class = ){}}}.

 

==============
This comes from [Romain's 
suggestion|https://github.com/apache/arrow/pull/11502/files/2a8a139b727acb13019da6176444578ead6bf208#r735351673]
 to transform the test that rely on capturing a string by using a snapshot test 
(added in {{{}testthat{}}}'s 3rd edition).

A test like:
{code:r}
expect_error(expression, message)
{code}
becomes
{code:r}
expect_snapshot({
  (expect_error(expression))
})
{code}
This is probably a more general improvement we can make to our unit tests (i.e. 
to make more extensive use of the snapshot functionality), but I thought I'd 
focus on one test file to begin with.

  was:
This comes from [Romain's 
suggestion|https://github.com/apache/arrow/pull/11502/files/2a8a139b727acb13019da6176444578ead6bf208#r735351673]
 to transform the test that rely on capturing a string by using a snapshot test 
(added in {{testthat}}'s 3rd edition). 

A test like:
{code:r}
expect_error(expression, message)
{code}

becomes
{code:r}
expect_snapshot({
  (expect_error(expression))
})
{code}

This is probably a more general improvement we can make to our unit tests (i.e. 
to make more extensive use of the snapshot functionality), but I thought I'd 
focus on one test file to begin with.


> [R] Use expect_snapshot() to improve tests in dplyr funcs strings
> -----------------------------------------------------------------
>
>                 Key: ARROW-14458
>                 URL: https://issues.apache.org/jira/browse/ARROW-14458
>             Project: Apache Arrow
>          Issue Type: Improvement
>          Components: R
>            Reporter: Dragoș Moldovan-Grünfeld
>            Assignee: Dragoș Moldovan-Grünfeld
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 8.0.0
>
>          Time Spent: 8h
>  Remaining Estimate: 0h
>
> Update (2022, January 20):
> [Hadley's 
> suggestion|https://github.com/r-lib/testthat/issues/1471#issuecomment-1005372257]
>  would be to move away from the
> {code:r}
> expect_snapshot({
>   (expect_error())
> }) 
> {code}
> pattern and use one of 3 options:
>  
>  * If you want to inspect the error message, use {{{}expect_snapshot(error = 
> TRUE){}}}.
>  * If you want to check the class, use {{expect_error(class = )}}
>  * If you want to expect the message and check the class, use 
> {{{}expect_snapshot_error(class = ){}}}.
>  
> ==============
> This comes from [Romain's 
> suggestion|https://github.com/apache/arrow/pull/11502/files/2a8a139b727acb13019da6176444578ead6bf208#r735351673]
>  to transform the test that rely on capturing a string by using a snapshot 
> test (added in {{{}testthat{}}}'s 3rd edition).
> A test like:
> {code:r}
> expect_error(expression, message)
> {code}
> becomes
> {code:r}
> expect_snapshot({
>   (expect_error(expression))
> })
> {code}
> This is probably a more general improvement we can make to our unit tests 
> (i.e. to make more extensive use of the snapshot functionality), but I 
> thought I'd focus on one test file to begin with.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to