-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
expose number of active injectors from matcher
- Loading branch information
1 parent
88a0853
commit 980413f
Showing
2 changed files
with
72 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
use std::sync::Arc; | ||
|
||
use nucleo_matcher::Config; | ||
|
||
use crate::Nucleo; | ||
|
||
#[test] | ||
fn active_injector_count() { | ||
let mut nucleo: Nucleo<()> = Nucleo::new(Config::DEFAULT, Arc::new(|| ()), Some(1), 1); | ||
assert_eq!(nucleo.active_injectors(), 0); | ||
let injector = nucleo.injector(); | ||
assert_eq!(nucleo.active_injectors(), 1); | ||
let injector2 = nucleo.injector(); | ||
assert_eq!(nucleo.active_injectors(), 2); | ||
drop(injector2); | ||
assert_eq!(nucleo.active_injectors(), 1); | ||
nucleo.restart(false); | ||
assert_eq!(nucleo.active_injectors(), 0); | ||
let injector3 = nucleo.injector(); | ||
assert_eq!(nucleo.active_injectors(), 1); | ||
nucleo.tick(0); | ||
assert_eq!(nucleo.active_injectors(), 1); | ||
drop(injector); | ||
assert_eq!(nucleo.active_injectors(), 1); | ||
drop(injector3); | ||
assert_eq!(nucleo.active_injectors(), 0); | ||
} |