diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/sys/select.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/sys/select.rs b/src/sys/select.rs index 9359cc59..a46985bc 100644 --- a/src/sys/select.rs +++ b/src/sys/select.rs @@ -341,6 +341,20 @@ mod tests { } #[test] + fn fdset_fds() { + let mut set = FdSet::new(); + assert_eq!(set.fds(None).collect::<Vec<_>>(), vec![]); + set.insert(0); + assert_eq!(set.fds(None).collect::<Vec<_>>(), vec![0]); + set.insert(90); + assert_eq!(set.fds(None).collect::<Vec<_>>(), vec![0, 90]); + + // highest limit + assert_eq!(set.fds(Some(89)).collect::<Vec<_>>(), vec![0]); + assert_eq!(set.fds(Some(90)).collect::<Vec<_>>(), vec![0, 90]); + } + + #[test] fn test_select() { let (r1, w1) = pipe().unwrap(); write(w1, b"hi!").unwrap(); |