about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2014-04-30 20:56:40 -0700
committerAlex Crichton <alex@alexcrichton.com>2014-05-07 08:14:26 -0700
commit1a989d67697fe33e51e7209511e89ba7faaba21d (patch)
treecc309941ad82f1e9eea4f4ead6ba9074c723cb6f /src/libcore
parent54b81997f367e8963d722c5e23bd7a877d0273cd (diff)
downloadrust-1a989d67697fe33e51e7209511e89ba7faaba21d.tar.gz
rust-1a989d67697fe33e51e7209511e89ba7faaba21d.zip
core: Bring clone tests up to date in style
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/clone.rs75
1 files changed, 39 insertions, 36 deletions
diff --git a/src/libcore/clone.rs b/src/libcore/clone.rs
index 36d1cd9ba94..0e39e3c36b7 100644
--- a/src/libcore/clone.rs
+++ b/src/libcore/clone.rs
@@ -126,46 +126,49 @@ extern_fn_clone!(A, B, C, D, E, F)
 extern_fn_clone!(A, B, C, D, E, F, G)
 extern_fn_clone!(A, B, C, D, E, F, G, H)
 
-#[test]
-fn test_owned_clone() {
-    let a = box 5i;
-    let b: Box<int> = a.clone();
-    assert_eq!(a, b);
-}
+#[cfg(test)]
+mod test {
+    #[test]
+    fn test_owned_clone() {
+        let a = box 5i;
+        let b: Box<int> = a.clone();
+        assert_eq!(a, b);
+    }
 
-#[test]
-fn test_managed_clone() {
-    let a = @5i;
-    let b: @int = a.clone();
-    assert_eq!(a, b);
-}
+    #[test]
+    fn test_managed_clone() {
+        let a = @5i;
+        let b: @int = a.clone();
+        assert_eq!(a, b);
+    }
 
-#[test]
-fn test_borrowed_clone() {
-    let x = 5i;
-    let y: &int = &x;
-    let z: &int = (&y).clone();
-    assert_eq!(*z, 5);
-}
+    #[test]
+    fn test_borrowed_clone() {
+        let x = 5i;
+        let y: &int = &x;
+        let z: &int = (&y).clone();
+        assert_eq!(*z, 5);
+    }
 
-#[test]
-fn test_clone_from() {
-    let a = box 5;
-    let mut b = box 10;
-    b.clone_from(&a);
-    assert_eq!(*b, 5);
-}
+    #[test]
+    fn test_clone_from() {
+        let a = ~5;
+        let mut b = ~10;
+        b.clone_from(&a);
+        assert_eq!(*b, 5);
+    }
 
-#[test]
-fn test_extern_fn_clone() {
-    trait Empty {}
-    impl Empty for int {}
+    #[test]
+    fn test_extern_fn_clone() {
+        trait Empty {}
+        impl Empty for int {}
 
-    fn test_fn_a() -> f64 { 1.0 }
-    fn test_fn_b<T: Empty>(x: T) -> T { x }
-    fn test_fn_c(_: int, _: f64, _: ~[int], _: int, _: int, _: int) {}
+        fn test_fn_a() -> f64 { 1.0 }
+        fn test_fn_b<T: Empty>(x: T) -> T { x }
+        fn test_fn_c(_: int, _: f64, _: ~[int], _: int, _: int, _: int) {}
 
-    let _ = test_fn_a.clone();
-    let _ = test_fn_b::<int>.clone();
-    let _ = test_fn_c.clone();
+        let _ = test_fn_a.clone();
+        let _ = test_fn_b::<int>.clone();
+        let _ = test_fn_c.clone();
+    }
 }