Skip to content

Commit

Permalink
gio: sync test with master
Browse files Browse the repository at this point in the history
  • Loading branch information
Paolo Borelli committed Jun 17, 2024
1 parent 1058b8a commit 909e298
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions gio/tests/std_io_copy.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
use std::io;

use gio::prelude::*;

#[test]
#[cfg(feature = "v2_36")]
fn std_io_copy_with_gio() {
let bytes = glib::Bytes::from_owned([1, 2, 3]);
let mut read = gio::MemoryInputStream::new_from_bytes(&bytes).into_read();
let mut read = gio::MemoryInputStream::from_bytes(&bytes).into_read();
let mut write = gio::MemoryOutputStream::new_resizable().into_write();

let result = io::copy(&mut read, &mut write);
let result = std::io::copy(&mut read, &mut write);

let out_stream = write.into_output_stream();
out_stream.close(gio::Cancellable::NONE).unwrap();
assert_eq!(result.unwrap(), 3);
assert_eq!(out_stream.steal_as_bytes().unwrap(), bytes);
assert_eq!(out_stream.steal_as_bytes(), bytes);
}

0 comments on commit 909e298

Please sign in to comment.