diff options
| author | bors <bors@rust-lang.org> | 2021-03-22 22:56:37 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-03-22 22:56:37 +0000 |
| commit | 9bb6d54577665fb3abb6cf27c40ed5247ff3fc7f (patch) | |
| tree | c2ee8c2f33f9a4007eff807c98940fa0d4f0efcc /library/std/src/sys/unix/kernel_copy/tests.rs | |
| parent | 73f48e5f6f6217c4bf93026bc0072637966d6eab (diff) | |
| parent | f9dd96d576a872736cceb4a4a58bc03d62b421fc (diff) | |
| download | rust-9bb6d54577665fb3abb6cf27c40ed5247ff3fc7f.tar.gz rust-9bb6d54577665fb3abb6cf27c40ed5247ff3fc7f.zip | |
Auto merge of #83377 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum
[stable] 1.51.0 release Also includes backports of the release notes, as well as: * SplitInclusive is public API #83372 * std: Fix a bug on the wasm32-wasi target opening files #82804 * Fix io::copy specialization using copy_file_range when writer was opened with O_APPEND #82417 r? `@Mark-Simulacrum`
Diffstat (limited to 'library/std/src/sys/unix/kernel_copy/tests.rs')
| -rw-r--r-- | library/std/src/sys/unix/kernel_copy/tests.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/library/std/src/sys/unix/kernel_copy/tests.rs b/library/std/src/sys/unix/kernel_copy/tests.rs index 77369cdd35f..3fe849e23e2 100644 --- a/library/std/src/sys/unix/kernel_copy/tests.rs +++ b/library/std/src/sys/unix/kernel_copy/tests.rs @@ -65,6 +65,24 @@ fn copy_specialization() -> Result<()> { result.and(rm1).and(rm2) } +#[test] +fn copies_append_mode_sink() -> Result<()> { + let tmp_path = tmpdir(); + let source_path = tmp_path.join("copies_append_mode.source"); + let sink_path = tmp_path.join("copies_append_mode.sink"); + let mut source = + OpenOptions::new().create(true).truncate(true).write(true).read(true).open(&source_path)?; + write!(source, "not empty")?; + source.seek(SeekFrom::Start(0))?; + let mut sink = OpenOptions::new().create(true).append(true).open(&sink_path)?; + + let copied = crate::io::copy(&mut source, &mut sink)?; + + assert_eq!(copied, 9); + + Ok(()) +} + #[bench] fn bench_file_to_file_copy(b: &mut test::Bencher) { const BYTES: usize = 128 * 1024; |
