File tree Expand file tree Collapse file tree 1 file changed +16
-10
lines changed Expand file tree Collapse file tree 1 file changed +16
-10
lines changed Original file line number Diff line number Diff line change @@ -56,16 +56,22 @@ fn main() -> std::io::Result<()> {
56
56
// Get an initial list of files - may not work correctly on non-UTF8 OsString
57
57
let files: Vec < String > = if matches. contains_id ( "path" ) {
58
58
let dir_path = Path :: new ( matches. get_one :: < String > ( "path" ) . unwrap ( ) ) ;
59
- println ! ( "Running tests in directory: {:?}" , dir_path) ;
60
- fs:: read_dir ( dir_path) ?
61
- . filter_map ( |entry| {
62
- if entry. is_ok ( ) {
63
- Some ( entry. unwrap ( ) . path ( ) . to_string_lossy ( ) . to_string ( ) )
64
- } else {
65
- None
66
- }
67
- } )
68
- . collect ( )
59
+
60
+ if std:: fs:: metadata ( & dir_path) . unwrap ( ) . is_dir ( ) {
61
+ println ! ( "Running tests in directory: {:?}" , dir_path) ;
62
+ fs:: read_dir ( dir_path) ?
63
+ . filter_map ( |entry| {
64
+ if entry. is_ok ( ) {
65
+ Some ( entry. unwrap ( ) . path ( ) . to_string_lossy ( ) . to_string ( ) )
66
+ } else {
67
+ None
68
+ }
69
+ } )
70
+ . collect ( )
71
+ } else {
72
+ println ! ( "Running single test: {:?}" , dir_path) ;
73
+ vec ! [ dir_path. to_string_lossy( ) . to_string( ) ]
74
+ }
69
75
} else {
70
76
matches. get_many :: < String > ( "files" ) . unwrap_or_default ( ) . map ( |name| name. to_string ( ) ) . collect ( )
71
77
} ;
You can’t perform that action at this time.
0 commit comments