File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change 11# ' Extract a reprex from a failed expectation
22# '
3+ # ' @description
34# ' `extract_test()` creates a minimal reprex for a failed expectation.
45# ' It extracts all non-test code before the failed expectation as well as
56# ' all code inside the test up to and including the failed expectation.
67# '
8+ # ' This is particularly useful when you're debugging test failures in
9+ # ' someone else's package.
10+ # '
711# ' @param location A string giving the location in the form
812# '   `FILE:LINE[:COLUMN]`.
913# ' @param path Path to write the reprex to. Defaults to `stdout()`.
1014# ' @return This function is called for its side effect of rendering a
1115# '   reprex to `path`. This function will never error: if extraction
1216# '   fails, the error message will be written to `path`.
1317# ' @export
18+ # ' @examples
19+ # ' # If you see a test failure like this:
20+ # ' # ββ Failure (test-extract.R:46:3): errors if can't find test βββββββββββββββ
21+ # ' # Expected FALSE to be TRUE.
22+ # ' # Differences:
23+ # ' # `actual`:   FALSE
24+ # ' # `expected`: TRUE
25+ # '
26+ # ' # You can run this:
27+ # ' \dontrun{extract_test("test-extract.R:46:3")}
28+ # ' # to see just the code needed to reproduce the failure
1429extract_test  <-  function (location , path  =  stdout()) {
1530  check_string(location )
1631
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You canβt perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments