From d375171fd44247bff3e355fb82d88b83f14da442 Mon Sep 17 00:00:00 2001 From: Jack Moffitt Date: Fri, 5 Apr 2013 17:51:43 -0600 Subject: [PATCH] Move tests inside clone.rs and fixed copyright headers. --- src/libcore/clone.rs | 23 +++++++++++++++- .../borrowck-borrow-from-expr-block.rs | 2 +- src/test/run-pass/clones.rs | 27 ------------------- 3 files changed, 23 insertions(+), 29 deletions(-) delete mode 100644 src/test/run-pass/clones.rs diff --git a/src/libcore/clone.rs b/src/libcore/clone.rs index 10cce4f69c6..c4b5bb8d98b 100644 --- a/src/libcore/clone.rs +++ b/src/libcore/clone.rs @@ -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 // http://rust-lang.org/COPYRIGHT. // @@ -73,3 +73,24 @@ clone_impl!(f64) clone_impl!(bool) 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); +} diff --git a/src/test/run-pass/borrowck-borrow-from-expr-block.rs b/src/test/run-pass/borrowck-borrow-from-expr-block.rs index fc7786d08cb..077de5c7eb1 100644 --- a/src/test/run-pass/borrowck-borrow-from-expr-block.rs +++ b/src/test/run-pass/borrowck-borrow-from-expr-block.rs @@ -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 // http://rust-lang.org/COPYRIGHT. // diff --git a/src/test/run-pass/clones.rs b/src/test/run-pass/clones.rs deleted file mode 100644 index f4fa1b81ab1..00000000000 --- a/src/test/run-pass/clones.rs +++ /dev/null @@ -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 or the MIT license -// , 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)); -}