SHARE
TWEET

Untitled

a guest Jul 12th, 2019 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. trait SomeTrait {
  2.     fn def(&self) -> bool {
  3.         false
  4.     }
  5. }
  6.  
  7. struct SomeStruct;
  8.  
  9. #[cfg(not(test))]
  10. impl SomeTrait for SomeStruct {}
  11.  
  12. #[cfg(test)]
  13. mod tests {
  14.     use super::*;
  15.  
  16.     impl SomeTrait for SomeStruct {
  17.         fn def(&self) -> bool{
  18.            true
  19.         }
  20.     }
  21.  
  22.     #[test]
  23.     fn it_works() {
  24.         let s = SomeStruct {};
  25.  
  26.         assert!(s.def());
  27.     }
  28.  
  29. }
  30.  
  31.  
  32. fn main(){
  33.      let s = SomeStruct {};
  34.  
  35.      assert!(s.def());
  36. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top