MCPcopy Create free account
hub / github.com/bytecodealliance/system-interface / cap_append_all_vectored

Function cap_append_all_vectored

tests/append.rs:13–32  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

11#[cfg(any(not(windows), feature = "cap_std_impls"))]
12#[test]
13fn cap_append_all_vectored() {
14 let tmpdir = tmpdir();
15 let file = check!(tmpdir.open_with(
16 "file",
17 cap_std::fs::OpenOptions::new()
18 .create_new(true)
19 .read(true)
20 .write(true)
21 ));
22 check!(write!(&file, "abcdefghijklmnopqrstuvwxyz"));
23 check!(file.seek(std::io::SeekFrom::Start(0)));
24 let buf0 = b"EFGHIJKL".to_vec();
25 let buf1 = b"MNOPQRST".to_vec();
26 let mut bufs = vec![IoSlice::new(&buf0), IoSlice::new(&buf1)];
27 check!(file.append_all_vectored(&mut bufs));
28 assert_eq!(check!(file.stream_position()), 0);
29 let mut back = String::new();
30 check!(file.read_to_string(&mut back));
31 assert_eq!(back, "abcdefghijklmnopqrstuvwxyzEFGHIJKLMNOPQRST");
32}
33
34#[test]
35fn append_all_vectored() {

Callers

nothing calls this directly

Calls 1

tmpdirFunction · 0.85

Tested by

no test coverage detected