Skip to content

Commit e74d06c

Browse files
committed
fix(test2): Rename Trial to FnCase
1 parent 06a2551 commit e74d06c

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

crates/libtest2/examples/tidy.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1+
use libtest2::FnCase;
12
use libtest2::RunError;
23
use libtest2::RunResult;
3-
use libtest2::Trial;
44

55
fn main() -> std::io::Result<()> {
66
let harness = ::libtest2_harness::Harness::new();
@@ -23,8 +23,8 @@ fn main() -> std::io::Result<()> {
2323

2424
/// Creates one test for each `.rs` file in the current directory or
2525
/// sub-directories of the current directory.
26-
fn collect_tests() -> std::io::Result<Vec<Trial>> {
27-
fn visit_dir(path: &std::path::Path, tests: &mut Vec<Trial>) -> std::io::Result<()> {
26+
fn collect_tests() -> std::io::Result<Vec<FnCase>> {
27+
fn visit_dir(path: &std::path::Path, tests: &mut Vec<FnCase>) -> std::io::Result<()> {
2828
let current_dir = std::env::current_dir()?;
2929
for entry in std::fs::read_dir(path)? {
3030
let entry = entry?;
@@ -44,7 +44,7 @@ fn collect_tests() -> std::io::Result<Vec<Trial>> {
4444
.to_string_lossy()
4545
.into_owned();
4646

47-
let test = Trial::test(name, move |_| check_file(&path));
47+
let test = FnCase::test(name, move |_| check_file(&path));
4848
tests.push(test);
4949
}
5050
} else if file_type.is_dir() {

crates/libtest2/src/trial.rs renamed to crates/libtest2/src/case.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ use libtest2_harness::TestKind;
55
use crate::RunResult;
66
use crate::TestContext;
77

8-
pub struct Trial {
8+
pub struct FnCase {
99
name: String,
1010
#[allow(clippy::type_complexity)]
1111
runner: Box<dyn Fn(&TestContext) -> RunResult + Send + Sync>,
1212
}
1313

14-
impl Trial {
14+
impl FnCase {
1515
pub fn test(
1616
name: impl Into<String>,
1717
runner: impl Fn(&TestContext) -> RunResult + Send + Sync + 'static,
@@ -23,7 +23,7 @@ impl Trial {
2323
}
2424
}
2525

26-
impl Case for Trial {
26+
impl Case for FnCase {
2727
fn name(&self) -> &str {
2828
&self.name
2929
}

crates/libtest2/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,20 @@
3030
//#![warn(clippy::print_stderr)]
3131
#![warn(clippy::print_stdout)]
3232

33+
mod case;
3334
mod macros;
34-
mod trial;
3535

3636
#[doc(hidden)]
3737
pub mod _private {
3838
pub use crate::_main as main;
3939
}
4040

4141
pub use _private::main;
42+
pub use case::main;
43+
pub use case::FnCase;
4244
pub use libtest2_harness::RunError;
4345
pub use libtest2_harness::RunResult;
4446
pub use libtest2_harness::TestContext;
45-
pub use trial::main;
46-
pub use trial::Trial;
4747

4848
#[doc = include_str!("../README.md")]
4949
#[cfg(doctest)]

crates/libtest2/src/macros.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ macro_rules! _main {
44
( $( $test:path ),* $(,)*) => {
55
fn main() {
66
$crate::main([
7-
$($crate::Trial::test(::std::stringify!($test), $test)),*
7+
$($crate::FnCase::test(::std::stringify!($test), $test)),*
88
]);
99
}
1010
}

0 commit comments

Comments
 (0)