core: Bring clone tests up to date in style

This commit is contained in:
Alex Crichton
2014-04-30 20:56:40 -07:00
parent 54b81997f3
commit 1a989d6769

View File

@@ -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)
extern_fn_clone!(A, B, C, D, E, F, G, H) extern_fn_clone!(A, B, C, D, E, F, G, H)
#[test] #[cfg(test)]
fn test_owned_clone() { mod test {
let a = box 5i; #[test]
let b: Box<int> = a.clone(); fn test_owned_clone() {
assert_eq!(a, b); let a = box 5i;
} let b: Box<int> = a.clone();
assert_eq!(a, b);
#[test] }
fn test_managed_clone() {
let a = @5i; #[test]
let b: @int = a.clone(); fn test_managed_clone() {
assert_eq!(a, b); let a = @5i;
} let b: @int = a.clone();
assert_eq!(a, b);
#[test] }
fn test_borrowed_clone() {
let x = 5i; #[test]
let y: &int = &x; fn test_borrowed_clone() {
let z: &int = (&y).clone(); let x = 5i;
assert_eq!(*z, 5); let y: &int = &x;
} let z: &int = (&y).clone();
assert_eq!(*z, 5);
#[test] }
fn test_clone_from() {
let a = box 5; #[test]
let mut b = box 10; fn test_clone_from() {
b.clone_from(&a); let a = ~5;
assert_eq!(*b, 5); let mut b = ~10;
} b.clone_from(&a);
assert_eq!(*b, 5);
#[test] }
fn test_extern_fn_clone() {
trait Empty {} #[test]
impl Empty for int {} fn test_extern_fn_clone() {
trait Empty {}
fn test_fn_a() -> f64 { 1.0 } impl Empty for int {}
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 }
let _ = test_fn_a.clone(); fn test_fn_c(_: int, _: f64, _: ~[int], _: int, _: int, _: int) {}
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();
}
} }