diff options
| author | Huon Wilson <dbau.pp+github@gmail.com> | 2013-05-16 14:15:37 +1000 |
|---|---|---|
| committer | Huon Wilson <dbau.pp+github@gmail.com> | 2013-05-16 22:55:08 +1000 |
| commit | cd2eb4701fc16e7acd6934759be043b1f7e5586d (patch) | |
| tree | 056658f88fad7d623ef7843e51992dc8c258050d /src/test | |
| parent | 2329651770d026ff422ad40dabe576965f46c852 (diff) | |
| download | rust-cd2eb4701fc16e7acd6934759be043b1f7e5586d.tar.gz rust-cd2eb4701fc16e7acd6934759be043b1f7e5586d.zip | |
syntax: implement #[deriving(DeepClone)]. Fixes #6514.
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/run-pass/deriving-clone-enum.rs | 7 | ||||
| -rw-r--r-- | src/test/run-pass/deriving-clone-generic-enum.rs | 17 | ||||
| -rw-r--r-- | src/test/run-pass/deriving-clone-generic-struct.rs | 6 | ||||
| -rw-r--r-- | src/test/run-pass/deriving-clone-generic-tuple-struct.rs | 16 | ||||
| -rw-r--r-- | src/test/run-pass/deriving-clone-struct.rs | 12 |
5 files changed, 49 insertions, 9 deletions
diff --git a/src/test/run-pass/deriving-clone-enum.rs b/src/test/run-pass/deriving-clone-enum.rs index 969e1fb5dd6..9ce965aa49f 100644 --- a/src/test/run-pass/deriving-clone-enum.rs +++ b/src/test/run-pass/deriving-clone-enum.rs @@ -8,11 +8,14 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[deriving(Clone)] +#[deriving(Clone, DeepClone)] enum E { A, B(()), C } -pub fn main() {} +pub fn main() { + let _ = A.clone(); + let _ = B(()).deep_clone(); +} diff --git a/src/test/run-pass/deriving-clone-generic-enum.rs b/src/test/run-pass/deriving-clone-generic-enum.rs index 23841017e93..78abbf504f3 100644 --- a/src/test/run-pass/deriving-clone-generic-enum.rs +++ b/src/test/run-pass/deriving-clone-generic-enum.rs @@ -1,8 +1,21 @@ -#[deriving(Clone)] +// Copyright 2013 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. + +#[deriving(Clone, DeepClone)] enum E<T,U> { A(T), B(T,U), C } -fn main() {} +fn main() { + let _ = A::<int, int>(1i).clone(); + let _ = B(1i, 1.234).deep_clone(); +} diff --git a/src/test/run-pass/deriving-clone-generic-struct.rs b/src/test/run-pass/deriving-clone-generic-struct.rs index 0a7a5a3aa75..fd300cbc8b7 100644 --- a/src/test/run-pass/deriving-clone-generic-struct.rs +++ b/src/test/run-pass/deriving-clone-generic-struct.rs @@ -8,11 +8,13 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#[deriving(Clone)] +#[deriving(Clone, DeepClone)] struct S<T> { foo: (), bar: (), baz: T, } -pub fn main() {} +pub fn main() { + let _ = S { foo: (), bar: (), baz: 1i }.clone().deep_clone(); +} diff --git a/src/test/run-pass/deriving-clone-generic-tuple-struct.rs b/src/test/run-pass/deriving-clone-generic-tuple-struct.rs index d6a69e8e6ac..c082a11eab8 100644 --- a/src/test/run-pass/deriving-clone-generic-tuple-struct.rs +++ b/src/test/run-pass/deriving-clone-generic-tuple-struct.rs @@ -1,4 +1,16 @@ -#[deriving(Clone)] +// Copyright 2013 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. + +#[deriving(Clone, DeepClone)] struct S<T>(T, ()); -fn main() {} +fn main() { + let _ = S(1i, ()).clone().deep_clone(); +} diff --git a/src/test/run-pass/deriving-clone-struct.rs b/src/test/run-pass/deriving-clone-struct.rs index 4dcbadbb3ef..d540b047af7 100644 --- a/src/test/run-pass/deriving-clone-struct.rs +++ b/src/test/run-pass/deriving-clone-struct.rs @@ -1,4 +1,14 @@ -#[deriving(Clone)] +// Copyright 2013 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. + +#[deriving(Clone, DeepClone)] struct S { _int: int, _i8: i8, |
