File tree Expand file tree Collapse file tree 4 files changed +11
-11
lines changed Expand file tree Collapse file tree 4 files changed +11
-11
lines changed Original file line number Diff line number Diff line change 1+ use libtest2:: FnCase ;
12use libtest2:: RunError ;
23use libtest2:: RunResult ;
3- use libtest2:: Trial ;
44
55fn 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 ( ) {
Original file line number Diff line number Diff line change @@ -5,13 +5,13 @@ use libtest2_harness::TestKind;
55use crate :: RunResult ;
66use 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 }
Original file line number Diff line number Diff line change 3030//#![warn(clippy::print_stderr)]
3131#![ warn( clippy:: print_stdout) ]
3232
33+ mod case;
3334mod macros;
34- mod trial;
3535
3636#[ doc( hidden) ]
3737pub mod _private {
3838 pub use crate :: _main as main;
3939}
4040
4141pub use _private:: main;
42+ pub use case:: main;
43+ pub use case:: FnCase ;
4244pub use libtest2_harness:: RunError ;
4345pub use libtest2_harness:: RunResult ;
4446pub use libtest2_harness:: TestContext ;
45- pub use trial:: main;
46- pub use trial:: Trial ;
4747
4848#[ doc = include_str ! ( "../README.md" ) ]
4949#[ cfg( doctest) ]
Original file line number Diff line number Diff 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 }
You can’t perform that action at this time.
0 commit comments