diff options
| author | bors <bors@rust-lang.org> | 2014-03-29 11:41:37 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-03-29 11:41:37 -0700 |
| commit | d878df05ad589d1ae3f4e087bbc8abba1b459703 (patch) | |
| tree | 4fc8b2f734f94938d60fe6bfe2d2a0a4c11d7bbb /src/test | |
| parent | 3eb3a02c92e129e87561ebcf927543679bf7c74d (diff) | |
| parent | 63b233c25d45f4dc792fa864ddf710ce9ddd0224 (diff) | |
| download | rust-d878df05ad589d1ae3f4e087bbc8abba1b459703.tar.gz rust-d878df05ad589d1ae3f4e087bbc8abba1b459703.zip | |
auto merge of #13183 : erickt/rust/remove-list, r=alexcrichton
`collections::list::List` was decided in a [team meeting](https://github.com/mozilla/rust/wiki/Meeting-weekly-2014-03-25) that it was unnecessary, so this PR removes it. Additionally, it removes an old and redundant purity test and fixes some warnings.
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/bench/task-perf-alloc-unwind.rs | 6 | ||||
| -rw-r--r-- | src/test/run-pass/log-knows-the-names-of-variants-in-std.rs | 21 | ||||
| -rw-r--r-- | src/test/run-pass/non-boolean-pure-fns.rs | 36 |
3 files changed, 20 insertions, 43 deletions
diff --git a/src/test/bench/task-perf-alloc-unwind.rs b/src/test/bench/task-perf-alloc-unwind.rs index 4a53b3cbfe4..fc7e6a03bcf 100644 --- a/src/test/bench/task-perf-alloc-unwind.rs +++ b/src/test/bench/task-perf-alloc-unwind.rs @@ -13,12 +13,16 @@ extern crate collections; extern crate time; -use collections::list::{List, Cons, Nil}; use time::precise_time_s; use std::os; use std::task; use std::vec; +#[deriving(Clone)] +enum List<T> { + Nil, Cons(T, @List<T>) +} + enum UniqueList { ULNil, ULCons(~UniqueList) } diff --git a/src/test/run-pass/log-knows-the-names-of-variants-in-std.rs b/src/test/run-pass/log-knows-the-names-of-variants-in-std.rs index 0129740252c..7e120658aae 100644 --- a/src/test/run-pass/log-knows-the-names-of-variants-in-std.rs +++ b/src/test/run-pass/log-knows-the-names-of-variants-in-std.rs @@ -10,9 +10,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -extern crate collections; -use collections::list::List; - #[deriving(Clone)] enum foo { a(uint), @@ -24,9 +21,21 @@ fn check_log<T>(exp: ~str, v: T) { } pub fn main() { - let x = List::from_vec([a(22u), b(~"hi")]); - let exp = ~"Cons(a(22u), @Cons(b(~\"hi\"), @Nil))"; + let mut x = Some(a(22u)); + let exp = ~"Some(a(22u))"; + let act = format!("{:?}", x); + assert_eq!(act, exp); + check_log(exp, x); + + x = Some(b(~"hi")); + let exp = ~"Some(b(~\"hi\"))"; + let act = format!("{:?}", x); + assert_eq!(act, exp); + check_log(exp, x); + + x = None; + let exp = ~"None"; let act = format!("{:?}", x); - assert!(act == exp); + assert_eq!(act, exp); check_log(exp, x); } diff --git a/src/test/run-pass/non-boolean-pure-fns.rs b/src/test/run-pass/non-boolean-pure-fns.rs deleted file mode 100644 index 66bb2e702be..00000000000 --- a/src/test/run-pass/non-boolean-pure-fns.rs +++ /dev/null @@ -1,36 +0,0 @@ -// ignore-fast - -// Copyright 2012-2014 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. - -#[feature(managed_boxes)]; - -extern crate collections; - -use collections::list::{List, Cons, Nil}; - -fn pure_length_go<T>(ls: @List<T>, acc: uint) -> uint { - match *ls { Nil => { acc } Cons(_, tl) => { pure_length_go(tl, acc + 1u) } } -} - -fn pure_length<T>(ls: @List<T>) -> uint { pure_length_go(ls, 0u) } - -fn nonempty_list<T>(ls: @List<T>) -> bool { pure_length(ls) > 0u } - -fn safe_head<T:Clone>(ls: @List<T>) -> T { - assert!(!ls.is_empty()); - return ls.head().unwrap().clone(); -} - -pub fn main() { - let mylist = @Cons(@1u, @Nil); - assert!((nonempty_list(mylist))); - assert_eq!(*safe_head(mylist), 1u); -} |
