diff options
| author | Steven Fackler <sfackler@gmail.com> | 2014-06-28 13:57:36 -0700 |
|---|---|---|
| committer | Steven Fackler <sfackler@gmail.com> | 2014-06-29 15:57:21 -0700 |
| commit | 1ed646eaf7d09455a086afa11bcd83a7d2a6b0f4 (patch) | |
| tree | 3c7bc58191bc3b260c4522c115ddf869b986193f /src/libcore/clone.rs | |
| parent | ff94f867d29a90ab59060c10a62f65994776a8c4 (diff) | |
| download | rust-1ed646eaf7d09455a086afa11bcd83a7d2a6b0f4.tar.gz rust-1ed646eaf7d09455a086afa11bcd83a7d2a6b0f4.zip | |
Extract tests from libcore to a separate crate
Libcore's test infrastructure is complicated by the fact that many lang items are defined in the crate. The current approach (realcore/realstd imports) is hacky and hard to work with (tests inside of core::cmp haven't been run for months!). Moving tests to a separate crate does mean that they can only test the public API of libcore, but I don't feel that that is too much of an issue. The only tests that I had to get rid of were some checking the various numeric formatters, but those are also exercised through normal format! calls in other tests.
Diffstat (limited to 'src/libcore/clone.rs')
| -rw-r--r-- | src/libcore/clone.rs | 60 |
1 files changed, 0 insertions, 60 deletions
diff --git a/src/libcore/clone.rs b/src/libcore/clone.rs index 04f01db3147..247f63115a7 100644 --- a/src/libcore/clone.rs +++ b/src/libcore/clone.rs @@ -110,63 +110,3 @@ 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, H) -#[cfg(test)] -mod test { - use prelude::*; - use realstd::owned::Box; - use realstd::gc::{Gc, GC}; - - fn realclone<T: ::realstd::clone::Clone>(t: &T) -> T { - use realstd::clone::Clone; - t.clone() - } - - fn realclone_from<T: ::realstd::clone::Clone>(t1: &mut T, t2: &T) { - use realstd::clone::Clone; - t1.clone_from(t2) - } - - #[test] - fn test_owned_clone() { - let a = box 5i; - let b: Box<int> = realclone(&a); - assert!(a == b); - } - - #[test] - fn test_managed_clone() { - let a = box(GC) 5i; - let b: Gc<int> = realclone(&a); - assert!(a == b); - } - - #[test] - fn test_borrowed_clone() { - let x = 5i; - let y: &int = &x; - let z: &int = (&y).clone(); - assert_eq!(*z, 5); - } - - #[test] - fn test_clone_from() { - let a = box 5i; - let mut b = box 10i; - realclone_from(&mut b, &a); - assert_eq!(*b, 5); - } - - #[test] - fn test_extern_fn_clone() { - trait Empty {} - impl Empty for int {} - - fn test_fn_a() -> f64 { 1.0 } - fn test_fn_b<T: Empty>(x: T) -> T { x } - fn test_fn_c(_: int, _: f64, _: int, _: int, _: int) {} - - let _ = test_fn_a.clone(); - let _ = test_fn_b::<int>.clone(); - let _ = test_fn_c.clone(); - } -} |
