core: Bring clone tests up to date in style
This commit is contained in:
@@ -126,38 +126,40 @@ 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 {
|
||||||
|
#[test]
|
||||||
|
fn test_owned_clone() {
|
||||||
let a = box 5i;
|
let a = box 5i;
|
||||||
let b: Box<int> = a.clone();
|
let b: Box<int> = a.clone();
|
||||||
assert_eq!(a, b);
|
assert_eq!(a, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_managed_clone() {
|
fn test_managed_clone() {
|
||||||
let a = @5i;
|
let a = @5i;
|
||||||
let b: @int = a.clone();
|
let b: @int = a.clone();
|
||||||
assert_eq!(a, b);
|
assert_eq!(a, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_borrowed_clone() {
|
fn test_borrowed_clone() {
|
||||||
let x = 5i;
|
let x = 5i;
|
||||||
let y: &int = &x;
|
let y: &int = &x;
|
||||||
let z: &int = (&y).clone();
|
let z: &int = (&y).clone();
|
||||||
assert_eq!(*z, 5);
|
assert_eq!(*z, 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_clone_from() {
|
fn test_clone_from() {
|
||||||
let a = box 5;
|
let a = ~5;
|
||||||
let mut b = box 10;
|
let mut b = ~10;
|
||||||
b.clone_from(&a);
|
b.clone_from(&a);
|
||||||
assert_eq!(*b, 5);
|
assert_eq!(*b, 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_extern_fn_clone() {
|
fn test_extern_fn_clone() {
|
||||||
trait Empty {}
|
trait Empty {}
|
||||||
impl Empty for int {}
|
impl Empty for int {}
|
||||||
|
|
||||||
@@ -168,4 +170,5 @@ fn test_extern_fn_clone() {
|
|||||||
let _ = test_fn_a.clone();
|
let _ = test_fn_a.clone();
|
||||||
let _ = test_fn_b::<int>.clone();
|
let _ = test_fn_b::<int>.clone();
|
||||||
let _ = test_fn_c.clone();
|
let _ = test_fn_c.clone();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user