File tree Expand file tree Collapse file tree 2 files changed +41
-0
lines changed 
postgresql_extensions/src Expand file tree Collapse file tree 2 files changed +41
-0
lines changed Original file line number Diff line number Diff line change @@ -224,4 +224,33 @@ mod test {
224224        let  error = Error :: from ( parse_error) ; 
225225        assert_eq ! ( error. to_string( ) ,  "empty host" ) ; 
226226    } 
227+ 
228+     #[ cfg( feature = "maven" ) ]  
229+     #[ test]  
230+     fn  test_from_quick_xml_error ( )  { 
231+         let  xml = "<invalid>" ; 
232+         let  quick_xml_error = quick_xml:: de:: from_str :: < String > ( xml) . expect_err ( "quick_xml error" ) ; 
233+         let  error = Error :: from ( quick_xml_error) ; 
234+         assert ! ( matches!( error,  Error :: ParseError ( _) ) ) ; 
235+     } 
236+ 
237+     #[ cfg( feature = "zip" ) ]  
238+     #[ test]  
239+     fn  test_from_zip_error ( )  { 
240+         let  zip_error = zip:: result:: ZipError :: FileNotFound ; 
241+         let  error = Error :: from ( zip_error) ; 
242+         assert ! ( matches!( error,  Error :: Unexpected ( _) ) ) ; 
243+         assert ! ( 
244+             error
245+                 . to_string( ) 
246+                 . contains( "specified file not found in archive" ) 
247+         ) ; 
248+     } 
249+ 
250+     #[ test]  
251+     fn  test_from_poisoned_lock ( )  { 
252+         let  error = Error :: from ( std:: sync:: PoisonError :: new ( ( ) ) ) ; 
253+         assert ! ( matches!( error,  Error :: PoisonedLock ( _) ) ) ; 
254+         assert ! ( error. to_string( ) . contains( "poisoned lock" ) ) ; 
255+     } 
227256} 
Original file line number Diff line number Diff line change @@ -38,3 +38,15 @@ impl<T> From<PoisonError<T>> for Error {
3838        Error :: PoisonedLock ( value. to_string ( ) ) 
3939    } 
4040} 
41+ 
42+ #[ cfg( test) ]  
43+ mod  tests { 
44+     use  super :: * ; 
45+ 
46+     #[ test]  
47+     fn  test_from_poison_error ( )  { 
48+         let  error = Error :: from ( std:: sync:: PoisonError :: new ( ( ) ) ) ; 
49+         assert ! ( matches!( error,  Error :: PoisonedLock ( _) ) ) ; 
50+         assert ! ( error. to_string( ) . contains( "poisoned lock" ) ) ; 
51+     } 
52+ } 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments