Move tests inside clone.rs and fixed copyright headers.
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
|
||||||
// file at the top-level directory of this distribution and at
|
// file at the top-level directory of this distribution and at
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
// http://rust-lang.org/COPYRIGHT.
|
||||||
//
|
//
|
||||||
@@ -73,3 +73,24 @@ clone_impl!(f64)
|
|||||||
|
|
||||||
clone_impl!(bool)
|
clone_impl!(bool)
|
||||||
clone_impl!(char)
|
clone_impl!(char)
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_owned_clone() {
|
||||||
|
let a : ~int = ~5i;
|
||||||
|
let b : ~int = a.clone();
|
||||||
|
assert!(a == b);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_managed_clone() {
|
||||||
|
let a : @int = @5i;
|
||||||
|
let b : @int = a.clone();
|
||||||
|
assert!(a == b);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_managed_mut_clone() {
|
||||||
|
let a : @int = @5i;
|
||||||
|
let b : @int = a.clone();
|
||||||
|
assert!(a == b);
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
|
||||||
// file at the top-level directory of this distribution and at
|
// file at the top-level directory of this distribution and at
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
// http://rust-lang.org/COPYRIGHT.
|
||||||
//
|
//
|
||||||
|
|||||||
@@ -1,27 +0,0 @@
|
|||||||
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
|
|
||||||
// file at the top-level directory of this distribution and at
|
|
||||||
// http://rust-lang.org/COPYRIGHT.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
||||||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
||||||
// option. This file may not be copied, modified, or distributed
|
|
||||||
// except according to those terms.
|
|
||||||
|
|
||||||
fn main() {
|
|
||||||
let a : ~int = ~5i;
|
|
||||||
let b : ~int = a.clone();
|
|
||||||
|
|
||||||
debug!(fmt!("a: %?, b: %?", a, b));
|
|
||||||
|
|
||||||
let a : @int = @5i;
|
|
||||||
let b : @int = a.clone();
|
|
||||||
|
|
||||||
debug!(fmt!("a: %?, b: %?", a, b));
|
|
||||||
|
|
||||||
let a : @mut int = @mut 5i;
|
|
||||||
let b : @mut int = a.clone();
|
|
||||||
*b = 6;
|
|
||||||
|
|
||||||
debug!(fmt!("a: %?, b: %?", a, b));
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user