Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisduerr committed Oct 4, 2023
1 parent 1108897 commit 631ac85
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/loop_logic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1104,6 +1104,23 @@ mod tests {
assert!(ret.is_err());
}

#[test]
fn remove_during_callback() {
use crate::sources::timer::{TimeoutAction, Timer};

let mut event_loop = EventLoop::<RegistrationToken>::try_new().unwrap();
let handle = event_loop.handle();
let mut token = event_loop
.handle()
.insert_source(Timer::immediate(), move |_, _, token| {
handle.remove(*token);
TimeoutAction::Drop
})
.unwrap();

event_loop.dispatch(Duration::ZERO, &mut token).unwrap();
}

#[test]
fn insert_source_no_interest() {
use rustix::pipe::pipe;
Expand Down

0 comments on commit 631ac85

Please sign in to comment.