| 191 | |
| 192 | #[test] |
| 193 | fn read_exact() { |
| 194 | let dir = tempfile::tempdir().unwrap(); |
| 195 | let file = check!(OpenOptions::new() |
| 196 | .create_new(true) |
| 197 | .read(true) |
| 198 | .write(true) |
| 199 | .open(dir.path().join("file"))); |
| 200 | check!(write!(&file, "abcdefghijklmnopqrstuvwxyz")); |
| 201 | let mut buf0 = vec![0; 8]; |
| 202 | let mut buf1 = vec![0; 8]; |
| 203 | check!(file.seek(std::io::SeekFrom::Start(4))); |
| 204 | check!(file.read_exact(&mut buf0)); |
| 205 | check!(file.read_exact(&mut buf1)); |
| 206 | assert_eq!(check!(file.stream_position()), 20); |
| 207 | assert_eq!(&buf0, b"efghijkl"); |
| 208 | assert_eq!(&buf1, b"mnopqrst"); |
| 209 | } |
| 210 | |
| 211 | #[test] |
| 212 | fn read_vectored() { |