Skip to content

Commit b99a8ff

Browse files
committed
auto merge of #12621 : huonw/rust/time-test-doc, r=pnkfelix
Add `time` crate to index, expand docs of `test`.
2 parents 31e9c94 + 1b5be76 commit b99a8ff

File tree

2 files changed

+21
-7
lines changed

2 files changed

+21
-7
lines changed

src/doc/index.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ li {list-style-type: none; }
4242
* [The `sync` library for concurrency-enabled mechanisms and primitives](sync/index.html)
4343
* [The `syntax` library, the Rust parser](syntax/index.html)
4444
* [The `term` terminal-handling library](term/index.html)
45-
* [The `test` library](test/index.html)
45+
* [The `test` library containing the unit-testing & micro-benchmark framework](test/index.html)
46+
* [The `time` library](time/index.html)
4647
* [The `uuid` 128-bit universally unique identifier library](uuid/index.html)
4748

4849
# Tooling

src/libtest/lib.rs

+19-6
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,20 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// Support code for rustc's built in test runner generator. Currently,
12-
// none of this is meant for users. It is intended to support the
13-
// simplest interface possible for representing and running tests
14-
// while providing a base that other test frameworks may build off of.
11+
//! Support code for rustc's built in unit-test and micro-benchmarking
12+
//! framework.
13+
//!
14+
//! Almost all user code will only be interested in `BenchHarness` and
15+
//! `black_box`. All other interactions (such as writing tests and
16+
//! benchmarks themselves) should be done via the `#[test]` and
17+
//! `#[bench]` attributes.
18+
//!
19+
//! See the [Testing Guide](../guide-testing.html) for more details.
20+
21+
// Currently, not much of this is meant for users. It is intended to
22+
// support the simplest interface possible for representing and
23+
// running tests while providing a base that other test frameworks may
24+
// build off of.
1525

1626
#[crate_id = "test#0.10-pre"];
1727
#[comment = "Rust internal test library only used by rustc"];
@@ -127,7 +137,11 @@ impl TestFn {
127137
}
128138
}
129139

130-
// Structure passed to BenchFns
140+
/// Manager of the benchmarking runs.
141+
///
142+
/// This is feed into functions marked with `#[bench]` to allow for
143+
/// set-up & tear-down before running a piece of code repeatedly via a
144+
/// call to `iter`.
131145
pub struct BenchHarness {
132146
priv iterations: u64,
133147
priv ns_start: u64,
@@ -1575,4 +1589,3 @@ mod tests {
15751589
assert_eq!(*(m4.find(&~"throughput").unwrap()), Metric::new(50.0, 2.0));
15761590
}
15771591
}
1578-

0 commit comments

Comments
 (0)