@@ -7,7 +7,9 @@ use fuzzy_matcher::{FuzzyMatcher, skim::SkimMatcherV2};
77#[ test]
88fn should_find_cargo_process_by_cmd_name ( ) {
99 let mut process_manager = ProcessManager :: new ( ) . unwrap ( ) ;
10- let results = process_manager. find_processes ( "cargo" , & IgnoreOptions :: default ( ) ) ;
10+ let results = process_manager
11+ . inital_search ( "cargo" , & IgnoreOptions :: default ( ) )
12+ . unwrap ( ) ;
1113 assert ! ( !results. is_empty( ) ) ;
1214 assert ! (
1315 results
@@ -20,7 +22,9 @@ fn should_find_cargo_process_by_cmd_name() {
2022#[ test]
2123fn should_find_cargo_process_by_cmd_path ( ) {
2224 let mut process_manager = ProcessManager :: new ( ) . unwrap ( ) ;
23- let results = process_manager. find_processes ( "/cargo" , & IgnoreOptions :: default ( ) ) ;
25+ let results = process_manager
26+ . inital_search ( "/cargo" , & IgnoreOptions :: default ( ) )
27+ . unwrap ( ) ;
2428 assert ! ( !results. is_empty( ) ) ;
2529 assert ! (
2630 results
@@ -33,7 +37,9 @@ fn should_find_cargo_process_by_cmd_path() {
3337#[ test]
3438fn should_find_cargo_process_by_name_path_or_args ( ) {
3539 let mut process_manager = ProcessManager :: new ( ) . unwrap ( ) ;
36- let results = process_manager. find_processes ( "~cargo" , & IgnoreOptions :: default ( ) ) ;
40+ let results = process_manager
41+ . inital_search ( "~cargo" , & IgnoreOptions :: default ( ) )
42+ . unwrap ( ) ;
3743 assert ! ( !results. is_empty( ) ) ;
3844 assert ! ( results. iter( ) . all( |item| fuzzy_matches(
3945 item. process. cmd_path. as_ref( ) . unwrap( ) ,
@@ -46,7 +52,9 @@ fn should_find_cargo_process_by_name_path_or_args() {
4652#[ test]
4753fn should_find_cargo_process_by_args ( ) {
4854 let mut process_manager = ProcessManager :: new ( ) . unwrap ( ) ;
49- let results = process_manager. find_processes ( "-test" , & IgnoreOptions :: default ( ) ) ;
55+ let results = process_manager
56+ . inital_search ( "-test" , & IgnoreOptions :: default ( ) )
57+ . unwrap ( ) ;
5058 assert ! ( !results. is_empty( ) ) ;
5159 assert ! (
5260 results
@@ -64,7 +72,9 @@ fn should_find_cargo_process_by_port() {
6472 // NOTE: Sometimes system needs time to notice the port is in use
6573 thread:: sleep ( Duration :: from_millis ( 250 ) ) ;
6674 let mut process_manager = ProcessManager :: new ( ) . unwrap ( ) ;
67- let results = process_manager. find_processes ( & format ! ( ":{}" , port) , & IgnoreOptions :: default ( ) ) ;
75+ let results = process_manager
76+ . inital_search ( & format ! ( ":{}" , port) , & IgnoreOptions :: default ( ) )
77+ . unwrap ( ) ;
6878 assert ! ( !results. is_empty( ) ) ;
6979 assert ! ( results. iter( ) . all( |item| {
7080 fuzzy_matches(
@@ -78,13 +88,17 @@ fn should_find_cargo_process_by_port() {
7888#[ test]
7989fn should_find_cargo_process_by_pid ( ) {
8090 let mut process_manager = ProcessManager :: new ( ) . unwrap ( ) ;
81- let results = process_manager. find_processes ( "cargo" , & IgnoreOptions :: default ( ) ) ;
91+ let results = process_manager
92+ . inital_search ( "cargo" , & IgnoreOptions :: default ( ) )
93+ . unwrap ( ) ;
8294 let cargo_process_pid = results. nth ( Some ( 0 ) ) . map ( |r| r. pid ) . unwrap ( ) ;
8395
84- let restults = process_manager. find_processes (
85- & format ! ( "!{}" , cargo_process_pid) ,
86- & IgnoreOptions :: default ( ) ,
87- ) ;
96+ let restults = process_manager
97+ . inital_search (
98+ & format ! ( "!{}" , cargo_process_pid) ,
99+ & IgnoreOptions :: default ( ) ,
100+ )
101+ . unwrap ( ) ;
88102 assert_eq ! ( restults. len( ) , 1 ) ;
89103 assert_eq ! ( restults. nth( Some ( 0 ) ) . unwrap( ) . pid, cargo_process_pid) ;
90104 assert ! ( results_are_sorted_by_match_type( results) ) ;
@@ -93,13 +107,17 @@ fn should_find_cargo_process_by_pid() {
93107#[ test]
94108fn should_find_cargo_process_by_process_family ( ) {
95109 let mut process_manager = ProcessManager :: new ( ) . unwrap ( ) ;
96- let results = process_manager. find_processes ( "cargo" , & IgnoreOptions :: default ( ) ) ;
110+ let results = process_manager
111+ . inital_search ( "cargo" , & IgnoreOptions :: default ( ) )
112+ . unwrap ( ) ;
97113 let cargo_process_pid = results. nth ( Some ( 0 ) ) . map ( |r| r. pid ) . unwrap ( ) ;
98114
99- let results = process_manager. find_processes (
100- & format ! ( "@{}" , cargo_process_pid) ,
101- & IgnoreOptions :: default ( ) ,
102- ) ;
115+ let results = process_manager
116+ . inital_search (
117+ & format ! ( "@{}" , cargo_process_pid) ,
118+ & IgnoreOptions :: default ( ) ,
119+ )
120+ . unwrap ( ) ;
103121 assert ! ( !results. is_empty( ) ) ;
104122 assert ! (
105123 results
@@ -120,7 +138,7 @@ fn should_ignore_processes_in_usr_dir() {
120138 paths : vec ! [ Regex :: new( "/usr/*" ) . unwrap( ) ] ,
121139 ..Default :: default ( )
122140 } ;
123- let results = process_manager. find_processes ( "" , & ignore) ;
141+ let results = process_manager. inital_search ( "" , & ignore) . unwrap ( ) ;
124142 assert ! ( !results. is_empty( ) ) ;
125143 assert ! ( results. iter( ) . all( |item| {
126144 item. process
0 commit comments