Debian Codegraph @

debian/rust-vendor/rlimit/tests/it/windows.rs

raw
1 use super::atomically;
2
3 #[test]
4 fn maxstdio() {
5 atomically(|| {
6 assert_eq!(rlimit::getmaxstdio(), 512);
7 assert_eq!(rlimit::setmaxstdio(2048).unwrap(), 2048);
8 assert_eq!(rlimit::getmaxstdio(), 2048);
9 });
10 }
11
12 #[test]
13 fn maxstdio_overflow() {
14 // Test that u32::MAX is rejected (would overflow to negative when cast to c_int)
15 let result = rlimit::setmaxstdio(u32::MAX);
16 assert!(result.is_err());
17 assert_eq!(result.unwrap_err().kind(), std::io::ErrorKind::InvalidInput);
18 }
19
20 #[test]
21 fn maxstdio_large_value() {
22 // Test that values larger than c_int::MAX are rejected
23 let test_value = (std::os::raw::c_int::MAX as u32) + 1;
24 let result = rlimit::setmaxstdio(test_value);
25 assert!(result.is_err());
26 assert_eq!(result.unwrap_err().kind(), std::io::ErrorKind::InvalidInput);
27 }