| 11 | #[cfg(feature = "cap_std_impls")] |
| 12 | #[test] |
| 13 | fn file_is_read_write() { |
| 14 | let tmpdir = tmpdir(); |
| 15 | |
| 16 | let file = check!(tmpdir.open_with( |
| 17 | "file", |
| 18 | OpenOptions::new() |
| 19 | .create(true) |
| 20 | .truncate(true) |
| 21 | .write(true) |
| 22 | .read(true) |
| 23 | )); |
| 24 | assert_eq!(check!(file.is_read_write()), (true, true)); |
| 25 | |
| 26 | let file = check!(tmpdir.open_with("file", OpenOptions::new().append(true).read(true))); |
| 27 | assert_eq!(check!(file.is_read_write()), (true, true)); |
| 28 | |
| 29 | let file = check!(tmpdir.open_with( |
| 30 | "file", |
| 31 | OpenOptions::new() |
| 32 | .create(true) |
| 33 | .truncate(true) |
| 34 | .write(true) |
| 35 | .read(false) |
| 36 | )); |
| 37 | assert_eq!(check!(file.is_read_write()), (false, true)); |
| 38 | |
| 39 | let file = check!(tmpdir.open_with( |
| 40 | "file", |
| 41 | OpenOptions::new() |
| 42 | .create(false) |
| 43 | .truncate(false) |
| 44 | .write(false) |
| 45 | .read(true) |
| 46 | )); |
| 47 | assert_eq!(check!(file.is_read_write()), (true, false)); |
| 48 | } |
| 49 | |
| 50 | #[test] |
| 51 | fn socket_is_read_write() { |