Skip to content

Commit 53b9d1a

Browse files
committed
move extra::test to libtest
1 parent 0cc8ba0 commit 53b9d1a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+176
-137
lines changed

mk/crates.mk

+5-3
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
################################################################################
5151

5252
TARGET_CRATES := std extra green rustuv native flate arena glob term semver \
53-
uuid serialize sync getopts collections num
53+
uuid serialize sync getopts collections num test
5454
HOST_CRATES := syntax rustc rustdoc fourcc
5555
CRATES := $(TARGET_CRATES) $(HOST_CRATES)
5656
TOOLS := compiletest rustdoc rustc
@@ -63,7 +63,8 @@ DEPS_native := std
6363
DEPS_syntax := std term serialize collections
6464
DEPS_rustc := syntax native:rustllvm flate arena serialize sync getopts \
6565
collections extra
66-
DEPS_rustdoc := rustc native:sundown serialize sync getopts collections
66+
DEPS_rustdoc := rustc native:sundown serialize sync getopts collections \
67+
test
6768
DEPS_flate := std native:miniz
6869
DEPS_arena := std collections
6970
DEPS_glob := std
@@ -76,8 +77,9 @@ DEPS_getopts := std
7677
DEPS_collections := std serialize
7778
DEPS_fourcc := syntax std
7879
DEPS_num := std extra
80+
DEPS_test := std extra collections getopts serialize term
7981

80-
TOOL_DEPS_compiletest := extra green rustuv getopts
82+
TOOL_DEPS_compiletest := test green rustuv getopts
8183
TOOL_DEPS_rustdoc := rustdoc green rustuv
8284
TOOL_DEPS_rustc := rustc green rustuv
8385
TOOL_SOURCE_compiletest := $(S)src/compiletest/compiletest.rs

src/compiletest/compiletest.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,13 @@
1313
#[allow(non_camel_case_types)];
1414
#[deny(warnings)];
1515

16-
extern crate extra;
16+
extern crate test;
1717
extern crate getopts;
1818

1919
use std::os;
2020
use std::io;
2121
use std::io::fs;
22-
2322
use getopts::{optopt, optflag, reqopt};
24-
use extra::test;
25-
2623
use common::config;
2724
use common::mode_run_pass;
2825
use common::mode_run_fail;

src/compiletest/runtest.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ use std::str;
3434
use std::task;
3535
use std::vec;
3636

37-
use extra::test::MetricMap;
37+
use test::MetricMap;
3838

3939
pub fn run(config: config, testfile: ~str) {
4040

src/doc/guide-testing.md

+9-8
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ runner.
170170

171171
The type signature of a benchmark function differs from a unit test:
172172
it takes a mutable reference to type
173-
`extra::test::BenchHarness`. Inside the benchmark function, any
173+
`test::BenchHarness`. Inside the benchmark function, any
174174
time-variable or "setup" code should execute first, followed by a call
175175
to `iter` on the benchmark harness, passing a closure that contains
176176
the portion of the benchmark you wish to actually measure the
@@ -185,9 +185,10 @@ amount.
185185
For example:
186186

187187
~~~
188-
extern crate extra;
188+
extern crate test;
189+
189190
use std::vec;
190-
use extra::test::BenchHarness;
191+
use test::BenchHarness;
191192
192193
#[bench]
193194
fn bench_sum_1024_ints(b: &mut BenchHarness) {
@@ -243,8 +244,8 @@ recognize that some calculation has no external effects and remove
243244
it entirely.
244245

245246
~~~
246-
extern crate extra;
247-
use extra::test::BenchHarness;
247+
extern crate test;
248+
use test::BenchHarness;
248249
249250
#[bench]
250251
fn bench_xor_1000_ints(bh: &mut BenchHarness) {
@@ -273,15 +274,15 @@ example above by adjusting the `bh.iter` call to
273274
bh.iter(|| range(0, 1000).fold(0, |old, new| old ^ new))
274275
~~~
275276

276-
Or, the other option is to call the generic `extra::test::black_box`
277+
Or, the other option is to call the generic `test::black_box`
277278
function, which is an opaque "black box" to the optimizer and so
278279
forces it to consider any argument as used.
279280

280281
~~~
281-
use extra::test::black_box
282+
extern crate test;
282283
283284
bh.iter(|| {
284-
black_box(range(0, 1000).fold(0, |old, new| old ^ new));
285+
test::black_box(range(0, 1000).fold(0, |old, new| old ^ new));
285286
});
286287
~~~
287288

src/doc/rustdoc.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ testing this code, the `fib` function will be included (so it can compile).
154154

155155
Running tests often requires some special configuration to filter tests, find
156156
libraries, or try running ignored examples. The testing framework that rustdoc
157-
uses is build on `extra::test`, which is also used when you compile crates with
157+
uses is build on crate `test`, which is also used when you compile crates with
158158
rustc's `--test` flag. Extra arguments can be passed to rustdoc's test harness
159159
with the `--test-args` flag.
160160

src/libarena/lib.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -503,10 +503,10 @@ impl<T> Drop for TypedArena<T> {
503503
}
504504

505505
#[cfg(test)]
506-
mod test {
507-
extern crate extra;
506+
mod tests {
507+
extern crate test;
508+
use self::test::BenchHarness;
508509
use super::{Arena, TypedArena};
509-
use self::extra::test::BenchHarness;
510510

511511
struct Point {
512512
x: int,

src/libcollections/bitv.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -938,7 +938,8 @@ impl<'a> Iterator<uint> for BitPositions<'a> {
938938

939939
#[cfg(test)]
940940
mod tests {
941-
use extra::test::BenchHarness;
941+
extern crate test;
942+
use self::test::BenchHarness;
942943

943944
use bitv::{Bitv, SmallBitv, BigBitv, BitvSet, from_bools, from_fn,
944945
from_bytes};

src/libcollections/deque.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,11 @@ pub trait Deque<T> : Mutable {
4141

4242
#[cfg(test)]
4343
pub mod bench {
44+
extern crate test;
45+
use self::test::BenchHarness;
4446
use std::container::MutableMap;
4547
use std::{vec, rand};
4648
use std::rand::Rng;
47-
use extra::test::BenchHarness;
4849

4950
pub fn insert_rand_n<M:MutableMap<uint,uint>>(n: uint,
5051
map: &mut M,

src/libcollections/dlist.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -657,8 +657,9 @@ impl<D:Decoder,T:Decodable<D>> Decodable<D> for DList<T> {
657657

658658
#[cfg(test)]
659659
mod tests {
660+
extern crate test;
661+
use self::test::BenchHarness;
660662
use deque::Deque;
661-
use extra::test;
662663
use std::rand;
663664
use super::{DList, Node, ListInsertion};
664665

src/libcollections/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#[feature(macro_rules, managed_boxes)];
2121

2222
extern crate serialize;
23-
#[cfg(test)] extern crate extra; // benchmark tests need this
23+
#[cfg(test)] extern crate test;
2424

2525
pub use bitv::Bitv;
2626
pub use btree::BTree;

src/libcollections/ringbuf.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -431,8 +431,9 @@ impl<D:Decoder,T:Decodable<D>> Decodable<D> for RingBuf<T> {
431431

432432
#[cfg(test)]
433433
mod tests {
434+
extern crate test;
435+
use self::test::BenchHarness;
434436
use deque::Deque;
435-
use extra::test;
436437
use std::clone::Clone;
437438
use std::cmp::Eq;
438439
use super::RingBuf;

src/libcollections/smallintmap.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -470,9 +470,9 @@ mod test_map {
470470

471471
#[cfg(test)]
472472
mod bench {
473-
473+
extern crate test;
474+
use self::test::BenchHarness;
474475
use super::SmallIntMap;
475-
use extra::test::BenchHarness;
476476
use deque::bench::{insert_rand_n, insert_seq_n, find_rand_n, find_seq_n};
477477

478478
// Find seq

src/libcollections/treemap.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1494,9 +1494,9 @@ mod test_treemap {
14941494

14951495
#[cfg(test)]
14961496
mod bench {
1497-
1497+
extern crate test;
1498+
use self::test::BenchHarness;
14981499
use super::TreeMap;
1499-
use extra::test::BenchHarness;
15001500
use deque::bench::{insert_rand_n, insert_seq_n, find_rand_n, find_seq_n};
15011501

15021502
// Find seq

src/libextra/lib.rs

+1-10
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,10 @@ Rust extras are part of the standard Rust distribution.
3636

3737
extern crate sync;
3838
extern crate serialize;
39-
4039
extern crate collections;
4140

4241
// Utility modules
43-
4442
pub mod c_vec;
45-
46-
// And ... other stuff
47-
4843
pub mod url;
4944
pub mod json;
5045
pub mod tempfile;
@@ -56,15 +51,11 @@ pub mod stats;
5651
#[cfg(unicode)]
5752
mod unicode;
5853

59-
// Compiler support modules
60-
61-
pub mod test;
62-
6354
// A curious inner-module that's not exported that contains the binding
6455
// 'extra' so that macro-expanded references to extra::serialize and such
6556
// can be resolved within libextra.
6657
#[doc(hidden)]
6758
pub mod extra {
6859
pub use serialize;
69-
pub use test;
7060
}
61+

src/libextra/stats.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1025,7 +1025,8 @@ mod tests {
10251025

10261026
#[cfg(test)]
10271027
mod bench {
1028-
use extra::test::BenchHarness;
1028+
extern crate test;
1029+
use self::test::BenchHarness;
10291030
use std::vec;
10301031
use stats::Stats;
10311032

src/libnum/bigint.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -2546,11 +2546,12 @@ mod bigint_tests {
25462546

25472547
#[cfg(test)]
25482548
mod bench {
2549-
use super::{BigInt, BigUint};
2549+
extern crate test;
2550+
use self::test::BenchHarness;
2551+
use super::BigUint;
25502552
use std::iter;
25512553
use std::mem::replace;
25522554
use std::num::{FromPrimitive, Zero, One};
2553-
use extra::test::BenchHarness;
25542555

25552556
fn factorial(n: uint) -> BigUint {
25562557
let mut f: BigUint = One::one();

src/libnum/rational.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -430,8 +430,7 @@ mod test {
430430

431431
mod arith {
432432
use super::{_0, _1, _2, _1_2, _3_2, _neg1_2, to_big};
433-
use super::super::{Ratio, Rational, BigRational};
434-
433+
use super::super::{Ratio, Rational};
435434

436435
#[test]
437436
fn test_add() {

0 commit comments

Comments
 (0)