Skip to content

Commit ee52865

Browse files
committed
test: Update tests and import the prelude in some more places.
1 parent 1be40be commit ee52865

29 files changed

+66
-43
lines changed

src/libextra/arc.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,7 @@ pub impl<'self, T:Const + Owned> RWReadMode<'self, T> {
511511

512512
#[cfg(test)]
513513
mod tests {
514+
use core::prelude::*;
514515

515516
use arc::*;
516517
use arc;

src/libextra/dlist.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -534,6 +534,8 @@ impl<T> BaseIter<T> for @mut DList<T> {
534534

535535
#[cfg(test)]
536536
mod tests {
537+
use core::prelude::*;
538+
537539
use super::*;
538540

539541
#[test]

src/libextra/fileinput.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,8 @@ pub fn input_vec_state(files: ~[Option<Path>],
405405
406406
#[cfg(test)]
407407
mod test {
408+
use core::prelude::*;
409+
408410
use core::io::WriterUtil;
409411
use super::{FileInput, pathify, input_vec, input_vec_state};
410412

src/libextra/flatpipes.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -866,6 +866,8 @@ mod test {
866866
// Tests that the different backends behave the same when the
867867
// binary streaming protocol is broken
868868
mod broken_protocol {
869+
use core::prelude::*;
870+
869871
use flatpipes::{BytePort, FlatPort};
870872
use flatpipes::flatteners::PodUnflattener;
871873
use flatpipes::pod;

src/libextra/json.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1327,6 +1327,8 @@ impl to_str::ToStr for Error {
13271327

13281328
#[cfg(test)]
13291329
mod tests {
1330+
use core::prelude::*;
1331+
13301332
use super::*;
13311333

13321334
use core::hashmap::HashMap;

src/libextra/net_tcp.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1440,6 +1440,8 @@ struct TcpBufferedSocketData {
14401440

14411441
#[cfg(test)]
14421442
mod test {
1443+
use core::prelude::*;
1444+
14431445
use net::ip;
14441446
use net::tcp::{GenericListenErr, TcpConnectErrData, TcpListenErrData};
14451447
use net::tcp::{connect, accept, read, listen, TcpSocket, socket_buf};

src/libextra/num/bigint.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1145,6 +1145,8 @@ pub impl BigInt {
11451145
11461146
#[cfg(test)]
11471147
mod biguint_tests {
1148+
use core::prelude::*;
1149+
11481150
use super::*;
11491151
use core::num::{IntConvertible, Zero, One, FromStrRadix};
11501152
use core::cmp::{Less, Equal, Greater};
@@ -1611,6 +1613,8 @@ mod biguint_tests {
16111613
16121614
#[cfg(test)]
16131615
mod bigint_tests {
1616+
use core::prelude::*;
1617+
16141618
use super::*;
16151619
use core::cmp::{Less, Equal, Greater};
16161620
use core::num::{IntConvertible, Zero, One, FromStrRadix};

src/libextra/num/rational.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,8 @@ impl<T: FromStrRadix + Clone + Integer + Ord>
284284

285285
#[cfg(test)]
286286
mod test {
287+
use core::prelude::*;
288+
287289
use super::*;
288290
use core::num::{Zero,One,FromStrRadix,IntConvertible};
289291
use core::from_str::FromStr;

src/libextra/priority_queue.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -185,13 +185,13 @@ pub impl <T:Ord> PriorityQueue<T> {
185185
mod tests {
186186
use sort::merge_sort;
187187
use core::cmp::le;
188-
use priority_queue::PriorityQueue::{from_vec, new};
188+
use priority_queue::PriorityQueue;
189189

190190
#[test]
191191
fn test_top_and_pop() {
192192
let data = ~[2, 4, 6, 2, 1, 8, 10, 3, 5, 7, 0, 9, 1];
193193
let mut sorted = merge_sort(data, le);
194-
let mut heap = from_vec(data);
194+
let mut heap = PriorityQueue::from_vec(data);
195195
while !heap.is_empty() {
196196
assert_eq!(heap.top(), sorted.last());
197197
assert_eq!(heap.pop(), sorted.pop());
@@ -200,7 +200,7 @@ mod tests {
200200

201201
#[test]
202202
fn test_push() {
203-
let mut heap = from_vec(~[2, 4, 9]);
203+
let mut heap = PriorityQueue::from_vec(~[2, 4, 9]);
204204
assert_eq!(heap.len(), 3);
205205
assert!(*heap.top() == 9);
206206
heap.push(11);
@@ -222,7 +222,7 @@ mod tests {
222222

223223
#[test]
224224
fn test_push_unique() {
225-
let mut heap = from_vec(~[~2, ~4, ~9]);
225+
let mut heap = PriorityQueue::from_vec(~[~2, ~4, ~9]);
226226
assert_eq!(heap.len(), 3);
227227
assert!(*heap.top() == ~9);
228228
heap.push(~11);
@@ -244,7 +244,7 @@ mod tests {
244244

245245
#[test]
246246
fn test_push_pop() {
247-
let mut heap = from_vec(~[5, 5, 2, 1, 3]);
247+
let mut heap = PriorityQueue::from_vec(~[5, 5, 2, 1, 3]);
248248
assert_eq!(heap.len(), 5);
249249
assert_eq!(heap.push_pop(6), 6);
250250
assert_eq!(heap.len(), 5);
@@ -258,7 +258,7 @@ mod tests {
258258

259259
#[test]
260260
fn test_replace() {
261-
let mut heap = from_vec(~[5, 5, 2, 1, 3]);
261+
let mut heap = PriorityQueue::from_vec(~[5, 5, 2, 1, 3]);
262262
assert_eq!(heap.len(), 5);
263263
assert_eq!(heap.replace(6), 5);
264264
assert_eq!(heap.len(), 5);
@@ -271,7 +271,7 @@ mod tests {
271271
}
272272

273273
fn check_to_vec(data: ~[int]) {
274-
let heap = from_vec(copy data);
274+
let heap = PriorityQueue::from_vec(copy data);
275275
assert_eq!(merge_sort((copy heap).to_vec(), le), merge_sort(data, le));
276276
assert_eq!(heap.to_sorted_vec(), merge_sort(data, le));
277277
}
@@ -296,27 +296,27 @@ mod tests {
296296
#[test]
297297
#[should_fail]
298298
#[ignore(cfg(windows))]
299-
fn test_empty_pop() { let mut heap = new::<int>(); heap.pop(); }
299+
fn test_empty_pop() { let mut heap = PriorityQueue::new::<int>(); heap.pop(); }
300300

301301
#[test]
302302
fn test_empty_maybe_pop() {
303-
let mut heap = new::<int>();
303+
let mut heap = PriorityQueue::new::<int>();
304304
assert!(heap.maybe_pop().is_none());
305305
}
306306

307307
#[test]
308308
#[should_fail]
309309
#[ignore(cfg(windows))]
310-
fn test_empty_top() { let empty = new::<int>(); empty.top(); }
310+
fn test_empty_top() { let empty = PriorityQueue::new::<int>(); empty.top(); }
311311

312312
#[test]
313313
fn test_empty_maybe_top() {
314-
let empty = new::<int>();
314+
let empty = PriorityQueue::new::<int>();
315315
assert!(empty.maybe_top().is_none());
316316
}
317317

318318
#[test]
319319
#[should_fail]
320320
#[ignore(cfg(windows))]
321-
fn test_empty_replace() { let mut heap = new(); heap.replace(5); }
321+
fn test_empty_replace() { let mut heap = PriorityQueue::new(); heap.replace(5); }
322322
}

src/libextra/smallintmap.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,8 @@ pub impl SmallIntSet {
267267

268268
#[cfg(test)]
269269
mod tests {
270+
use core::prelude::*;
271+
270272
use super::SmallIntMap;
271273

272274
#[test]

0 commit comments

Comments
 (0)