Skip to content

Commit

Permalink
Use (empty) as debug representation of PollOpt::empty(). (tokio-rs#690)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmedcharles authored and alexcrichton committed Aug 22, 2017
1 parent 1771db2 commit 8eec1ff
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/event_imp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -504,10 +504,22 @@ impl fmt::Debug for PollOpt {
}
}

if !one {
fmt.write_str("(empty)")?;
}

Ok(())
}
}

#[test]
fn test_debug_pollopt() {
assert_eq!("(empty)", format!("{:?}", PollOpt::empty()));
assert_eq!("Edge-Triggered", format!("{:?}", PollOpt::edge()));
assert_eq!("Level-Triggered", format!("{:?}", PollOpt::level()));
assert_eq!("OneShot", format!("{:?}", PollOpt::oneshot()));
}

/// A set of readiness event kinds
///
/// `Ready` is a set of operation descriptors indicating which kind of an
Expand Down Expand Up @@ -914,6 +926,13 @@ impl fmt::Debug for Ready {
}
}

#[test]
fn test_debug_ready() {
assert_eq!("(empty)", format!("{:?}", Ready::empty()));
assert_eq!("Readable", format!("{:?}", Ready::readable()));
assert_eq!("Writable", format!("{:?}", Ready::writable()));
}

/// An readiness event returned by [`Poll::poll`].
///
/// `Event` is a [readiness state] paired with a [`Token`]. It is returned by
Expand Down

0 comments on commit 8eec1ff

Please sign in to comment.