id stringlengths 22 133 | text stringlengths 40 40.2k | arch stringclasses 1
value | syntax stringclasses 1
value | kind stringclasses 4
values | repo stringclasses 27
values | path stringlengths 5 116 | license stringclasses 6
values | commit stringlengths 40 40 | source_host stringclasses 1
value | category stringclasses 16
values | source_url stringlengths 85 196 | line_start int64 1 4.28k | line_end int64 4 4.31k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:18 | assert!(t.is_woken());
assert_ready_ok!(t.poll());
}
#[test]
fn sync_data_err_ordered_after_write() {
let (mock, file) = sys::File::mock();
mock.write(HELLO).sync_data_err();
let mut file = File::from_std(file);
let mut t = task::spawn(file.write(HELLO));
assert_ready_ok!(t.poll());
let m... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 78f2340d259487d4470681f97cc4b5eac719e178 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/78f2340d259487d4470681f97cc4b5eac719e178/tokio/tests/fs_file_mocked.rs | 681 | 740 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:19 | pool::run_one();
assert_eq!(0, mock.remaining());
assert!(t.is_woken());
assert_ready_ok!(t.poll());
}
#[test]
fn open_set_len_err() {
let (mock, file) = sys::File::mock();
mock.set_len_err(123);
let file = File::from_std(file);
let mut t = task::spawn(file.set_len(123));
assert_pend... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 78f2340d259487d4470681f97cc4b5eac719e178 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/78f2340d259487d4470681f97cc4b5eac719e178/tokio/tests/fs_file_mocked.rs | 721 | 780 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:20 | }
pool::run_one();
{
let mut t = task::spawn(file.set_len(123));
assert_pending!(t.poll());
pool::run_one();
assert_ready_ok!(t.poll());
}
let mut t = task::spawn(file.read(&mut buf));
assert_pending!(t.poll());
pool::run_one();
let n = assert_ready_ok!(t.... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 78f2340d259487d4470681f97cc4b5eac719e178 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/78f2340d259487d4470681f97cc4b5eac719e178/tokio/tests/fs_file_mocked.rs | 761 | 780 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:2 | // Place them where the source expects them
pub(crate) mod io {
pub(crate) use tokio::io::*;
pub(crate) use crate::blocking;
pub(crate) mod sys {
pub(crate) use crate::support::mock_pool::{run, Blocking};
}
}
pub(crate) mod fs {
pub(crate) mod sys {
pub(crate) use crate::support::m... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | afe535283c68dec40c5fc7a810445e8c2380880f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/afe535283c68dec40c5fc7a810445e8c2380880f/tokio/tests/fs_file_mocked.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
macro_rules! ready {
($e:expr $(,)?) => {
match $e {
std::task::Poll::Ready(t) => t,
std::task::Poll::Pending => return std::task::Poll::Pending,
}
};
}
#[macro_export]
macro_rules! cfg_fs {
($($item:item)*) => { ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | f0b2b708a71a55927ca11ad571ca7316b114eda5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f0b2b708a71a55927ca11ad571ca7316b114eda5/tokio/tests/fs_file_mocked.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:2 | // Place them where the source expects them
pub(crate) mod io {
pub(crate) use tokio::io::*;
pub(crate) use crate::blocking;
pub(crate) mod sys {
pub(crate) use crate::support::mock_pool::{run, Blocking};
}
}
pub(crate) mod fs {
pub(crate) mod sys {
pub(crate) use crate::support::m... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | f0b2b708a71a55927ca11ad571ca7316b114eda5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f0b2b708a71a55927ca11ad571ca7316b114eda5/tokio/tests/fs_file_mocked.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:3 | assert_pending!(t.poll());
assert_eq!(1, mock.remaining());
assert_eq!(1, pool::len());
pool::run_one();
assert_eq!(0, mock.remaining());
assert!(t.is_woken());
let n = assert_ready_ok!(t.poll());
assert_eq!(n, HELLO.len());
assert_eq!(&buf[..n], HELLO);
}
#[test]
fn read_twice_befo... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | f0b2b708a71a55927ca11ad571ca7316b114eda5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f0b2b708a71a55927ca11ad571ca7316b114eda5/tokio/tests/fs_file_mocked.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:4 | mock.read(HELLO);
let mut file = File::from_std(file);
{
let mut buf = [0; 32];
let mut t = task::spawn(file.read(&mut buf));
assert_pending!(t.poll());
}
pool::run_one();
{
let mut buf = [0; 4];
let mut t = task::spawn(file.read(&mut buf));
let n ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | f0b2b708a71a55927ca11ad571ca7316b114eda5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f0b2b708a71a55927ca11ad571ca7316b114eda5/tokio/tests/fs_file_mocked.rs | 121 | 180 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:5 | assert_pending!(t.poll());
}
pool::run_one();
{
let mut buf = [0; 32];
let mut t = task::spawn(file.read(&mut buf));
let n = assert_ready_ok!(t.poll());
assert_eq!(n, 4);
assert_eq!(&buf[..n], &HELLO[..n]);
}
// Calling again immediately succeeds with the r... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | f0b2b708a71a55927ca11ad571ca7316b114eda5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f0b2b708a71a55927ca11ad571ca7316b114eda5/tokio/tests/fs_file_mocked.rs | 161 | 220 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:6 | let mut t = task::spawn(file.read(&mut buf));
assert_pending!(t.poll());
pool::run_one();
assert_ready_err!(t.poll());
}
{
let mut buf = [0; 32];
let mut t = task::spawn(file.read(&mut buf));
assert_pending!(t.poll());
pool::run_one();
let n =... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | f0b2b708a71a55927ca11ad571ca7316b114eda5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f0b2b708a71a55927ca11ad571ca7316b114eda5/tokio/tests/fs_file_mocked.rs | 201 | 260 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:7 | assert!(!t.is_woken());
let mut t = task::spawn(file.flush());
assert_ready_ok!(t.poll());
}
#[test]
fn flush_while_idle() {
let (_mock, file) = sys::File::mock();
let mut file = File::from_std(file);
let mut t = task::spawn(file.flush());
assert_ready_ok!(t.poll());
}
#[test]
fn read_with_... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | f0b2b708a71a55927ca11ad571ca7316b114eda5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f0b2b708a71a55927ca11ad571ca7316b114eda5/tokio/tests/fs_file_mocked.rs | 241 | 300 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:8 | let mut pos = 0;
while pos < data.len() {
let mut t = task::spawn(file.read(&mut actual[pos..]));
assert_pending!(t.poll());
pool::run_one();
assert!(t.is_woken());
let n = assert_ready_ok!(t.poll());
assert!(n <= chunk_a);
pos += n;
}
assert_eq!(... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | f0b2b708a71a55927ca11ad571ca7316b114eda5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f0b2b708a71a55927ca11ad571ca7316b114eda5/tokio/tests/fs_file_mocked.rs | 281 | 340 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:9 | let mut file = File::from_std(file);
let mut rem = &data[..];
let mut first = true;
while !rem.is_empty() {
let mut task = task::spawn(file.write(rem));
if !first {
assert_pending!(task.poll());
pool::run_one();
assert!(task.is_woken());
}
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | f0b2b708a71a55927ca11ad571ca7316b114eda5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f0b2b708a71a55927ca11ad571ca7316b114eda5/tokio/tests/fs_file_mocked.rs | 321 | 380 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:10 | assert_eq!(pool::len(), 1);
pool::run_one();
assert!(t.is_woken());
assert_ready_ok!(t.poll());
let mut t = task::spawn(file.flush());
assert_pending!(t.poll());
assert_eq!(pool::len(), 1);
pool::run_one();
assert!(t.is_woken());
assert_ready_ok!(t.poll());
}
#[test]
fn incompl... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | f0b2b708a71a55927ca11ad571ca7316b114eda5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f0b2b708a71a55927ca11ad571ca7316b114eda5/tokio/tests/fs_file_mocked.rs | 361 | 420 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:11 | assert_ready_ok!(t.poll());
}
#[test]
fn incomplete_partial_read_followed_by_write() {
let (mock, file) = sys::File::mock();
mock.read(HELLO).seek_current_ok(-10, 0).write(FOO);
let mut file = File::from_std(file);
let mut buf = [0; 32];
let mut t = task::spawn(file.read(&mut buf));
assert_pe... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | f0b2b708a71a55927ca11ad571ca7316b114eda5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f0b2b708a71a55927ca11ad571ca7316b114eda5/tokio/tests/fs_file_mocked.rs | 401 | 460 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:12 | let mut t = task::spawn(file.read(&mut buf));
assert_pending!(t.poll());
pool::run_one();
let mut t = task::spawn(file.flush());
assert_ready_ok!(t.poll());
let mut t = task::spawn(file.write(FOO));
assert_ready_ok!(t.poll());
pool::run_one();
}
#[test]
fn incomplete_flush_followed_by_w... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | f0b2b708a71a55927ca11ad571ca7316b114eda5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f0b2b708a71a55927ca11ad571ca7316b114eda5/tokio/tests/fs_file_mocked.rs | 441 | 500 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:13 | #[test]
fn read_err() {
let (mock, file) = sys::File::mock();
mock.read_err();
let mut file = File::from_std(file);
let mut buf = [0; 1024];
let mut t = task::spawn(file.read(&mut buf));
assert_pending!(t.poll());
pool::run_one();
assert!(t.is_woken());
assert_ready_err!(t.poll(... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | f0b2b708a71a55927ca11ad571ca7316b114eda5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f0b2b708a71a55927ca11ad571ca7316b114eda5/tokio/tests/fs_file_mocked.rs | 481 | 540 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:14 | let mut file = File::from_std(file);
let mut t = task::spawn(file.write(HELLO));
assert_ready_ok!(t.poll());
pool::run_one();
let mut buf = [0; 1024];
let mut t = task::spawn(file.read(&mut buf));
assert_pending!(t.poll());
pool::run_one();
let mut t = task::spawn(file.write(FOO));... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | f0b2b708a71a55927ca11ad571ca7316b114eda5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f0b2b708a71a55927ca11ad571ca7316b114eda5/tokio/tests/fs_file_mocked.rs | 521 | 580 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:15 | #[test]
fn write_seek_write_err() {
let (mock, file) = sys::File::mock();
mock.write_err().seek_start_ok(0);
let mut file = File::from_std(file);
let mut t = task::spawn(file.write(HELLO));
assert_ready_ok!(t.poll());
pool::run_one();
{
let mut t = task::spawn(file.seek(SeekFrom:... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | f0b2b708a71a55927ca11ad571ca7316b114eda5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f0b2b708a71a55927ca11ad571ca7316b114eda5/tokio/tests/fs_file_mocked.rs | 561 | 620 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:16 | pool::run_one();
let mut t = task::spawn(file.flush());
assert_ready_err!(t.poll());
}
#[test]
fn sync_all_ordered_after_write() {
let (mock, file) = sys::File::mock();
mock.write(HELLO).sync_all();
let mut file = File::from_std(file);
let mut t = task::spawn(file.write(HELLO));
assert_re... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | f0b2b708a71a55927ca11ad571ca7316b114eda5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f0b2b708a71a55927ca11ad571ca7316b114eda5/tokio/tests/fs_file_mocked.rs | 601 | 660 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:17 | let mut t = task::spawn(file.sync_all());
assert_pending!(t.poll());
assert_eq!(1, pool::len());
pool::run_one();
assert!(t.is_woken());
assert_pending!(t.poll());
assert_eq!(1, pool::len());
pool::run_one();
assert!(t.is_woken());
assert_ready_err!(t.poll());
}
#[test]
fn sync_... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | f0b2b708a71a55927ca11ad571ca7316b114eda5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f0b2b708a71a55927ca11ad571ca7316b114eda5/tokio/tests/fs_file_mocked.rs | 641 | 700 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:18 | }
#[test]
fn sync_data_err_ordered_after_write() {
let (mock, file) = sys::File::mock();
mock.write(HELLO).sync_data_err();
let mut file = File::from_std(file);
let mut t = task::spawn(file.write(HELLO));
assert_ready_ok!(t.poll());
let mut t = task::spawn(file.sync_data());
assert_pendin... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | f0b2b708a71a55927ca11ad571ca7316b114eda5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f0b2b708a71a55927ca11ad571ca7316b114eda5/tokio/tests/fs_file_mocked.rs | 681 | 740 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:19 | assert!(t.is_woken());
assert_ready_ok!(t.poll());
}
#[test]
fn open_set_len_err() {
let (mock, file) = sys::File::mock();
mock.set_len_err(123);
let mut file = File::from_std(file);
let mut t = task::spawn(file.set_len(123));
assert_pending!(t.poll());
assert_eq!(1, mock.remaining());
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | f0b2b708a71a55927ca11ad571ca7316b114eda5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f0b2b708a71a55927ca11ad571ca7316b114eda5/tokio/tests/fs_file_mocked.rs | 721 | 777 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:20 | {
let mut t = task::spawn(file.set_len(123));
assert_pending!(t.poll());
pool::run_one();
assert_ready_ok!(t.poll());
}
let mut t = task::spawn(file.read(&mut buf));
assert_pending!(t.poll());
pool::run_one();
let n = assert_ready_ok!(t.poll());
assert_eq!(n, F... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | f0b2b708a71a55927ca11ad571ca7316b114eda5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f0b2b708a71a55927ca11ad571ca7316b114eda5/tokio/tests/fs_file_mocked.rs | 761 | 777 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:6 | let mut t = task::spawn(file.read(&mut buf));
assert_pending!(t.poll());
pool::run_one();
assert_ready_err!(t.poll());
}
{
let mut buf = [0; 32];
let mut t = task::spawn(file.read(&mut buf));
assert_pending!(t.poll());
pool::run_one();
let n =... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 7b4c999341809588a427a9a80d310ee4aa1c1a21 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7b4c999341809588a427a9a80d310ee4aa1c1a21/tokio/tests/fs_file_mocked.rs | 201 | 260 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:7 | assert!(!t.is_woken());
let mut t = task::spawn(file.flush());
assert_ready_ok!(t.poll());
}
#[test]
fn flush_while_idle() {
let (_mock, file) = sys::File::mock();
let mut file = File::from_std(file);
let mut t = task::spawn(file.flush());
assert_ready_ok!(t.poll());
}
#[test]
fn read_with_... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 7b4c999341809588a427a9a80d310ee4aa1c1a21 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7b4c999341809588a427a9a80d310ee4aa1c1a21/tokio/tests/fs_file_mocked.rs | 241 | 300 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:8 | let mut pos = 0;
while pos < data.len() {
let mut t = task::spawn(file.read(&mut actual[pos..]));
assert_pending!(t.poll());
pool::run_one();
assert!(t.is_woken());
let n = assert_ready_ok!(t.poll());
assert!(n <= a);
pos += n;
}
assert_eq!(mock.r... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 7b4c999341809588a427a9a80d310ee4aa1c1a21 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7b4c999341809588a427a9a80d310ee4aa1c1a21/tokio/tests/fs_file_mocked.rs | 281 | 340 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:9 | let mut file = File::from_std(file);
let mut rem = &data[..];
let mut first = true;
while !rem.is_empty() {
let mut t = task::spawn(file.write(rem));
if !first {
assert_pending!(t.poll());
pool::run_one();
assert!(t.is_woken());
}
firs... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 7b4c999341809588a427a9a80d310ee4aa1c1a21 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7b4c999341809588a427a9a80d310ee4aa1c1a21/tokio/tests/fs_file_mocked.rs | 321 | 380 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:1 | #![warn(rust_2018_idioms)]
macro_rules! ready {
($e:expr $(,)?) => {
match $e {
std::task::Poll::Ready(t) => t,
std::task::Poll::Pending => return std::task::Poll::Pending,
}
};
}
#[macro_export]
macro_rules! cfg_fs {
($($item:item)*) => { $($item)* }
}
#[macro_exp... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 0d38936b35779b604770120da2e98560bbb6241f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0d38936b35779b604770120da2e98560bbb6241f/tokio/tests/fs_file_mocked.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:2 | // Place them where the source expects them
pub(crate) mod io {
pub(crate) use tokio::io::*;
pub(crate) use crate::blocking;
pub(crate) mod sys {
pub(crate) use crate::support::mock_pool::{run, Blocking};
}
}
pub(crate) mod fs {
pub(crate) mod sys {
pub(crate) use crate::support::m... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 0d38936b35779b604770120da2e98560bbb6241f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0d38936b35779b604770120da2e98560bbb6241f/tokio/tests/fs_file_mocked.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:3 | assert_eq!(1, mock.remaining());
assert_eq!(1, pool::len());
pool::run_one();
assert_eq!(0, mock.remaining());
assert!(t.is_woken());
let n = assert_ready_ok!(t.poll());
assert_eq!(n, HELLO.len());
assert_eq!(&buf[..n], HELLO);
}
#[test]
fn read_twice_before_dispatch() {
let (mock, f... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 0d38936b35779b604770120da2e98560bbb6241f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0d38936b35779b604770120da2e98560bbb6241f/tokio/tests/fs_file_mocked.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:4 | let mut file = File::from_std(file);
{
let mut buf = [0; 32];
let mut t = task::spawn(file.read(&mut buf));
assert_pending!(t.poll());
}
pool::run_one();
{
let mut buf = [0; 4];
let mut t = task::spawn(file.read(&mut buf));
let n = assert_ready_ok!(t.po... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 0d38936b35779b604770120da2e98560bbb6241f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0d38936b35779b604770120da2e98560bbb6241f/tokio/tests/fs_file_mocked.rs | 121 | 180 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:5 | }
pool::run_one();
{
let mut buf = [0; 32];
let mut t = task::spawn(file.read(&mut buf));
let n = assert_ready_ok!(t.poll());
assert_eq!(n, 4);
assert_eq!(&buf[..n], &HELLO[..n]);
}
// Calling again immediately succeeds with the rest of the buffer
let mut b... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 0d38936b35779b604770120da2e98560bbb6241f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0d38936b35779b604770120da2e98560bbb6241f/tokio/tests/fs_file_mocked.rs | 161 | 220 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:6 | assert_pending!(t.poll());
pool::run_one();
assert_ready_err!(t.poll());
}
{
let mut buf = [0; 32];
let mut t = task::spawn(file.read(&mut buf));
assert_pending!(t.poll());
pool::run_one();
let n = assert_ready_ok!(t.poll());
assert_eq!(n, HE... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 0d38936b35779b604770120da2e98560bbb6241f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0d38936b35779b604770120da2e98560bbb6241f/tokio/tests/fs_file_mocked.rs | 201 | 260 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:7 | let mut t = task::spawn(file.flush());
assert_ready_ok!(t.poll());
}
#[test]
fn flush_while_idle() {
let (_mock, file) = sys::File::mock();
let mut file = File::from_std(file);
let mut t = task::spawn(file.flush());
assert_ready_ok!(t.poll());
}
#[test]
fn read_with_buffer_larger_than_max() {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 0d38936b35779b604770120da2e98560bbb6241f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0d38936b35779b604770120da2e98560bbb6241f/tokio/tests/fs_file_mocked.rs | 241 | 300 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:8 | while pos < data.len() {
let mut t = task::spawn(file.read(&mut actual[pos..]));
assert_pending!(t.poll());
pool::run_one();
assert!(t.is_woken());
let n = assert_ready_ok!(t.poll());
assert!(n <= a);
pos += n;
}
assert_eq!(mock.remaining(), 0);
as... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 0d38936b35779b604770120da2e98560bbb6241f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0d38936b35779b604770120da2e98560bbb6241f/tokio/tests/fs_file_mocked.rs | 281 | 340 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:9 | let mut rem = &data[..];
let mut first = true;
while !rem.is_empty() {
let mut t = task::spawn(file.write(rem));
if !first {
assert_pending!(t.poll());
pool::run_one();
assert!(t.is_woken());
}
first = false;
let n = assert_ready_o... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 0d38936b35779b604770120da2e98560bbb6241f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0d38936b35779b604770120da2e98560bbb6241f/tokio/tests/fs_file_mocked.rs | 321 | 380 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:10 | pool::run_one();
assert!(t.is_woken());
assert_ready_ok!(t.poll());
let mut t = task::spawn(file.flush());
assert_pending!(t.poll());
assert_eq!(pool::len(), 1);
pool::run_one();
assert!(t.is_woken());
assert_ready_ok!(t.poll());
}
#[test]
fn incomplete_read_followed_by_write() {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 0d38936b35779b604770120da2e98560bbb6241f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0d38936b35779b604770120da2e98560bbb6241f/tokio/tests/fs_file_mocked.rs | 361 | 420 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:11 | }
#[test]
fn incomplete_partial_read_followed_by_write() {
let (mock, file) = sys::File::mock();
mock.read(HELLO).seek_current_ok(-10, 0).write(FOO);
let mut file = File::from_std(file);
let mut buf = [0; 32];
let mut t = task::spawn(file.read(&mut buf));
assert_pending!(t.poll());
pool:... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 0d38936b35779b604770120da2e98560bbb6241f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0d38936b35779b604770120da2e98560bbb6241f/tokio/tests/fs_file_mocked.rs | 401 | 460 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:12 | let mut t = task::spawn(file.read(&mut buf));
assert_pending!(t.poll());
pool::run_one();
let mut t = task::spawn(file.flush());
assert_ready_ok!(t.poll());
let mut t = task::spawn(file.write(FOO));
assert_ready_ok!(t.poll());
pool::run_one();
}
#[test]
fn incomplete_flush_followed_by_w... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 0d38936b35779b604770120da2e98560bbb6241f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0d38936b35779b604770120da2e98560bbb6241f/tokio/tests/fs_file_mocked.rs | 441 | 500 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:13 | #[test]
fn read_err() {
let (mock, file) = sys::File::mock();
mock.read_err();
let mut file = File::from_std(file);
let mut buf = [0; 1024];
let mut t = task::spawn(file.read(&mut buf));
assert_pending!(t.poll());
pool::run_one();
assert!(t.is_woken());
assert_ready_err!(t.poll(... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 0d38936b35779b604770120da2e98560bbb6241f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0d38936b35779b604770120da2e98560bbb6241f/tokio/tests/fs_file_mocked.rs | 481 | 540 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:14 | let mut t = task::spawn(file.write(HELLO));
assert_ready_ok!(t.poll());
pool::run_one();
let mut buf = [0; 1024];
let mut t = task::spawn(file.read(&mut buf));
assert_pending!(t.poll());
pool::run_one();
let mut t = task::spawn(file.write(FOO));
assert_ready_err!(t.poll());
}
#[tes... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 0d38936b35779b604770120da2e98560bbb6241f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0d38936b35779b604770120da2e98560bbb6241f/tokio/tests/fs_file_mocked.rs | 521 | 580 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:15 | #[test]
fn write_seek_write_err() {
let (mock, file) = sys::File::mock();
mock.write_err().seek_start_ok(0);
let mut file = File::from_std(file);
let mut t = task::spawn(file.write(HELLO));
assert_ready_ok!(t.poll());
pool::run_one();
{
let mut t = task::spawn(file.seek(SeekFrom:... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 0d38936b35779b604770120da2e98560bbb6241f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0d38936b35779b604770120da2e98560bbb6241f/tokio/tests/fs_file_mocked.rs | 561 | 620 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:16 | pool::run_one();
let mut t = task::spawn(file.flush());
assert_ready_err!(t.poll());
}
#[test]
fn sync_all_ordered_after_write() {
let (mock, file) = sys::File::mock();
mock.write(HELLO).sync_all();
let mut file = File::from_std(file);
let mut t = task::spawn(file.write(HELLO));
assert_re... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 0d38936b35779b604770120da2e98560bbb6241f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0d38936b35779b604770120da2e98560bbb6241f/tokio/tests/fs_file_mocked.rs | 601 | 660 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:17 | let mut t = task::spawn(file.sync_all());
assert_pending!(t.poll());
assert_eq!(1, pool::len());
pool::run_one();
assert!(t.is_woken());
assert_pending!(t.poll());
assert_eq!(1, pool::len());
pool::run_one();
assert!(t.is_woken());
assert_ready_err!(t.poll());
}
#[test]
fn sync_... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 0d38936b35779b604770120da2e98560bbb6241f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0d38936b35779b604770120da2e98560bbb6241f/tokio/tests/fs_file_mocked.rs | 641 | 700 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:18 | #[test]
fn sync_data_err_ordered_after_write() {
let (mock, file) = sys::File::mock();
mock.write(HELLO).sync_data_err();
let mut file = File::from_std(file);
let mut t = task::spawn(file.write(HELLO));
assert_ready_ok!(t.poll());
let mut t = task::spawn(file.sync_data());
assert_pending!(... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 0d38936b35779b604770120da2e98560bbb6241f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/0d38936b35779b604770120da2e98560bbb6241f/tokio/tests/fs_file_mocked.rs | 681 | 740 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:1 | #![warn(rust_2018_idioms)]
macro_rules! ready {
($e:expr $(,)?) => {
match $e {
std::task::Poll::Ready(t) => t,
std::task::Poll::Pending => return std::task::Poll::Pending,
}
};
}
use futures::future;
// Load source
#[allow(warnings)]
#[path = "../src/fs/file.rs"]
mod ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 10dc659450d83c21de9661fc084ae83b4878098b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/10dc659450d83c21de9661fc084ae83b4878098b/tokio/tests/fs_file_mocked.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:2 | pub(crate) mod fs {
pub(crate) mod sys {
pub(crate) use crate::support::mock_file::File;
pub(crate) use crate::support::mock_pool::{run, Blocking};
}
pub(crate) use crate::support::mock_pool::asyncify;
}
use fs::sys;
use tokio::prelude::*;
use tokio_test::{assert_pending, assert_ready, ass... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 10dc659450d83c21de9661fc084ae83b4878098b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/10dc659450d83c21de9661fc084ae83b4878098b/tokio/tests/fs_file_mocked.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:3 | assert_eq!(n, HELLO.len());
assert_eq!(&buf[..n], HELLO);
}
#[test]
fn read_twice_before_dispatch() {
let (mock, file) = sys::File::mock();
mock.read(HELLO);
let mut file = File::from_std(file);
let mut buf = [0; 1024];
let mut t = task::spawn(file.read(&mut buf));
assert_pending!(t.poll... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 10dc659450d83c21de9661fc084ae83b4878098b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/10dc659450d83c21de9661fc084ae83b4878098b/tokio/tests/fs_file_mocked.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:4 | {
let mut buf = [0; 4];
let mut t = task::spawn(file.read(&mut buf));
let n = assert_ready_ok!(t.poll());
assert_eq!(n, 4);
assert_eq!(&buf[..], &HELLO[..n]);
}
// Calling again immediately succeeds with the rest of the buffer
let mut buf = [0; 32];
let mut t = t... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 10dc659450d83c21de9661fc084ae83b4878098b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/10dc659450d83c21de9661fc084ae83b4878098b/tokio/tests/fs_file_mocked.rs | 121 | 180 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:5 | }
// Calling again immediately succeeds with the rest of the buffer
let mut buf = [0; 32];
let mut t = task::spawn(file.read(&mut buf));
assert_pending!(t.poll());
assert_eq!(1, pool::len());
pool::run_one();
assert!(t.is_woken());
let n = assert_ready_ok!(t.poll());
assert_eq!(... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 10dc659450d83c21de9661fc084ae83b4878098b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/10dc659450d83c21de9661fc084ae83b4878098b/tokio/tests/fs_file_mocked.rs | 161 | 220 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:6 | assert_pending!(t.poll());
pool::run_one();
let n = assert_ready_ok!(t.poll());
assert_eq!(n, HELLO.len());
assert_eq!(&buf[..n], HELLO);
}
}
#[test]
fn open_write() {
let (mock, file) = sys::File::mock();
mock.write(HELLO);
let mut file = File::from_std(file);
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 10dc659450d83c21de9661fc084ae83b4878098b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/10dc659450d83c21de9661fc084ae83b4878098b/tokio/tests/fs_file_mocked.rs | 201 | 260 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:7 | let mut t = task::spawn(file.flush());
assert_ready_ok!(t.poll());
}
#[test]
fn read_with_buffer_larger_than_max() {
// Chunks
let a = 16 * 1024;
let b = a * 2;
let c = a * 3;
let d = a * 4;
assert_eq!(d / 1024, 64);
let mut data = vec![];
for i in 0..(d - 1) {
data.push((... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 10dc659450d83c21de9661fc084ae83b4878098b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/10dc659450d83c21de9661fc084ae83b4878098b/tokio/tests/fs_file_mocked.rs | 241 | 300 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:8 | pos += n;
}
assert_eq!(mock.remaining(), 0);
assert_eq!(data, &actual[..data.len()]);
}
#[test]
fn write_with_buffer_larger_than_max() {
// Chunks
let a = 16 * 1024;
let b = a * 2;
let c = a * 3;
let d = a * 4;
assert_eq!(d / 1024, 64);
let mut data = vec![];
for i in 0..... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 10dc659450d83c21de9661fc084ae83b4878098b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/10dc659450d83c21de9661fc084ae83b4878098b/tokio/tests/fs_file_mocked.rs | 281 | 340 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:9 | pool::run_one();
assert!(t.is_woken());
}
first = false;
let n = assert_ready_ok!(t.poll());
rem = &rem[n..];
}
pool::run_one();
assert_eq!(mock.remaining(), 0);
}
#[test]
fn write_twice_before_dispatch() {
let (mock, file) = sys::File::mock();
mock.... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 10dc659450d83c21de9661fc084ae83b4878098b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/10dc659450d83c21de9661fc084ae83b4878098b/tokio/tests/fs_file_mocked.rs | 321 | 380 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:10 | pool::run_one();
assert!(t.is_woken());
assert_ready_ok!(t.poll());
}
#[test]
fn incomplete_read_followed_by_write() {
let (mock, file) = sys::File::mock();
mock.read(HELLO)
.seek_current_ok(-(HELLO.len() as i64), 0)
.write(FOO);
let mut file = File::from_std(file);
let mut b... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 10dc659450d83c21de9661fc084ae83b4878098b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/10dc659450d83c21de9661fc084ae83b4878098b/tokio/tests/fs_file_mocked.rs | 361 | 420 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:11 | let mut t = task::spawn(file.read(&mut buf));
assert_pending!(t.poll());
pool::run_one();
let mut buf = [0; 4];
let mut t = task::spawn(file.read(&mut buf));
assert_ready_ok!(t.poll());
let mut t = task::spawn(file.write(FOO));
assert_ready_ok!(t.poll());
assert_eq!(pool::len(), 1);
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 10dc659450d83c21de9661fc084ae83b4878098b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/10dc659450d83c21de9661fc084ae83b4878098b/tokio/tests/fs_file_mocked.rs | 401 | 460 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:12 | pool::run_one();
}
#[test]
fn incomplete_flush_followed_by_write() {
let (mock, file) = sys::File::mock();
mock.write(HELLO).write(FOO);
let mut file = File::from_std(file);
let mut t = task::spawn(file.write(HELLO));
let n = assert_ready_ok!(t.poll());
assert_eq!(n, HELLO.len());
let mu... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 10dc659450d83c21de9661fc084ae83b4878098b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/10dc659450d83c21de9661fc084ae83b4878098b/tokio/tests/fs_file_mocked.rs | 441 | 500 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:13 | assert_pending!(t.poll());
pool::run_one();
assert!(t.is_woken());
assert_ready_err!(t.poll());
}
#[test]
fn write_write_err() {
let (mock, file) = sys::File::mock();
mock.write_err();
let mut file = File::from_std(file);
let mut t = task::spawn(file.write(HELLO));
assert_ready_ok!(... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 10dc659450d83c21de9661fc084ae83b4878098b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/10dc659450d83c21de9661fc084ae83b4878098b/tokio/tests/fs_file_mocked.rs | 481 | 540 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:14 | pool::run_one();
let mut t = task::spawn(file.write(FOO));
assert_ready_err!(t.poll());
}
#[test]
fn write_read_flush_err() {
let (mock, file) = sys::File::mock();
mock.write_err().read(HELLO);
let mut file = File::from_std(file);
let mut t = task::spawn(file.write(HELLO));
assert_ready_... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 10dc659450d83c21de9661fc084ae83b4878098b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/10dc659450d83c21de9661fc084ae83b4878098b/tokio/tests/fs_file_mocked.rs | 521 | 580 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:15 | pool::run_one();
{
let mut t = task::spawn(file.seek(SeekFrom::Start(0)));
assert_pending!(t.poll());
}
pool::run_one();
let mut t = task::spawn(file.write(FOO));
assert_ready_err!(t.poll());
}
#[test]
fn write_seek_flush_err() {
let (mock, file) = sys::File::mock();
mock... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 10dc659450d83c21de9661fc084ae83b4878098b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/10dc659450d83c21de9661fc084ae83b4878098b/tokio/tests/fs_file_mocked.rs | 561 | 620 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:16 | let mut file = File::from_std(file);
let mut t = task::spawn(file.write(HELLO));
assert_ready_ok!(t.poll());
let mut t = task::spawn(file.sync_all());
assert_pending!(t.poll());
assert_eq!(1, pool::len());
pool::run_one();
assert!(t.is_woken());
assert_pending!(t.poll());
assert_... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 10dc659450d83c21de9661fc084ae83b4878098b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/10dc659450d83c21de9661fc084ae83b4878098b/tokio/tests/fs_file_mocked.rs | 601 | 660 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:17 | pool::run_one();
assert!(t.is_woken());
assert_ready_err!(t.poll());
}
#[test]
fn sync_data_ordered_after_write() {
let (mock, file) = sys::File::mock();
mock.write(HELLO).sync_data();
let mut file = File::from_std(file);
let mut t = task::spawn(file.write(HELLO));
assert_ready_ok!(t.poll... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 10dc659450d83c21de9661fc084ae83b4878098b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/10dc659450d83c21de9661fc084ae83b4878098b/tokio/tests/fs_file_mocked.rs | 641 | 700 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:18 | let mut t = task::spawn(file.sync_data());
assert_pending!(t.poll());
assert_eq!(1, pool::len());
pool::run_one();
assert!(t.is_woken());
assert_pending!(t.poll());
assert_eq!(1, pool::len());
pool::run_one();
assert!(t.is_woken());
assert_ready_err!(t.poll());
}
#[test]
fn open... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 10dc659450d83c21de9661fc084ae83b4878098b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/10dc659450d83c21de9661fc084ae83b4878098b/tokio/tests/fs_file_mocked.rs | 681 | 740 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:19 | let mut t = task::spawn(file.set_len(123));
assert_pending!(t.poll());
assert_eq!(1, mock.remaining());
pool::run_one();
assert_eq!(0, mock.remaining());
assert!(t.is_woken());
assert_ready_err!(t.poll());
}
#[test]
fn partial_read_set_len_ok() {
let (mock, file) = sys::File::mock();
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 10dc659450d83c21de9661fc084ae83b4878098b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/10dc659450d83c21de9661fc084ae83b4878098b/tokio/tests/fs_file_mocked.rs | 721 | 766 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:1 | #![warn(rust_2018_idioms)]
macro_rules! ready {
($e:expr $(,)?) => {
match $e {
std::task::Poll::Ready(t) => t,
std::task::Poll::Pending => return std::task::Poll::Pending,
}
};
}
use futures::future;
// Load source
#[allow(warnings)]
#[path = "../src/fs/file.rs"]
mod ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 8a7e57786a5dca139f5b4261685e22991ded0859 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/tests/fs_file_mocked.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:2 | }
use fs::sys;
use tokio::io;
use tokio::prelude::*;
use tokio_test::{assert_pending, assert_ready, assert_ready_err, assert_ready_ok, task};
use std::io::SeekFrom;
const HELLO: &[u8] = b"hello world...";
const FOO: &[u8] = b"foo bar baz...";
#[test]
fn open_read() {
let (mock, file) = sys::File::mock();
mo... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 8a7e57786a5dca139f5b4261685e22991ded0859 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/tests/fs_file_mocked.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:3 | let (mock, file) = sys::File::mock();
mock.read(HELLO);
let mut file = File::from_std(file);
let mut buf = [0; 1024];
let mut t = task::spawn(file.read(&mut buf));
assert_pending!(t.poll());
assert_pending!(t.poll());
assert_eq!(pool::len(), 1);
pool::run_one();
assert!(t.is_wok... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 8a7e57786a5dca139f5b4261685e22991ded0859 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/tests/fs_file_mocked.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:4 | assert_eq!(&buf[..], &HELLO[..n]);
}
// Calling again immediately succeeds with the rest of the buffer
let mut buf = [0; 32];
let mut t = task::spawn(file.read(&mut buf));
let n = assert_ready_ok!(t.poll());
assert_eq!(n, 10);
assert_eq!(&buf[..n], &HELLO[4..]);
assert_eq!(0, pool::len... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 8a7e57786a5dca139f5b4261685e22991ded0859 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/tests/fs_file_mocked.rs | 121 | 180 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:5 | assert_pending!(t.poll());
assert_eq!(1, pool::len());
pool::run_one();
assert!(t.is_woken());
let n = assert_ready_ok!(t.poll());
assert_eq!(n, 10);
assert_eq!(&buf[..n], &HELLO[4..]);
assert_eq!(0, pool::len());
}
#[test]
fn read_err_then_read_success() {
let (mock, file) = sys::F... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 8a7e57786a5dca139f5b4261685e22991ded0859 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/tests/fs_file_mocked.rs | 161 | 220 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:6 | assert_eq!(n, HELLO.len());
assert_eq!(&buf[..n], HELLO);
}
}
#[test]
fn open_write() {
let (mock, file) = sys::File::mock();
mock.write(HELLO);
let mut file = File::from_std(file);
let mut t = task::spawn(file.write(HELLO));
assert_eq!(0, pool::len());
assert_ready_ok!(t.poll())... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 8a7e57786a5dca139f5b4261685e22991ded0859 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/tests/fs_file_mocked.rs | 201 | 260 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:7 | fn read_with_buffer_larger_than_max() {
// Chunks
let a = 16 * 1024;
let b = a * 2;
let c = a * 3;
let d = a * 4;
assert_eq!(d / 1024, 64);
let mut data = vec![];
for i in 0..(d - 1) {
data.push((i % 151) as u8);
}
let (mock, file) = sys::File::mock();
mock.read(&d... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 8a7e57786a5dca139f5b4261685e22991ded0859 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/tests/fs_file_mocked.rs | 241 | 300 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:8 | }
#[test]
fn write_with_buffer_larger_than_max() {
// Chunks
let a = 16 * 1024;
let b = a * 2;
let c = a * 3;
let d = a * 4;
assert_eq!(d / 1024, 64);
let mut data = vec![];
for i in 0..(d - 1) {
data.push((i % 151) as u8);
}
let (mock, file) = sys::File::mock();
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 8a7e57786a5dca139f5b4261685e22991ded0859 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/tests/fs_file_mocked.rs | 281 | 340 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:9 | let n = assert_ready_ok!(t.poll());
rem = &rem[n..];
}
pool::run_one();
assert_eq!(mock.remaining(), 0);
}
#[test]
fn write_twice_before_dispatch() {
let (mock, file) = sys::File::mock();
mock.write(HELLO).write(FOO);
let mut file = File::from_std(file);
let mut t = task::spawn... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 8a7e57786a5dca139f5b4261685e22991ded0859 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/tests/fs_file_mocked.rs | 321 | 380 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:10 | #[test]
fn incomplete_read_followed_by_write() {
let (mock, file) = sys::File::mock();
mock.read(HELLO)
.seek_current_ok(-(HELLO.len() as i64), 0)
.write(FOO);
let mut file = File::from_std(file);
let mut buf = [0; 32];
let mut t = task::spawn(file.read(&mut buf));
assert_pend... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 8a7e57786a5dca139f5b4261685e22991ded0859 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/tests/fs_file_mocked.rs | 361 | 420 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:11 | let mut t = task::spawn(file.read(&mut buf));
assert_ready_ok!(t.poll());
let mut t = task::spawn(file.write(FOO));
assert_ready_ok!(t.poll());
assert_eq!(pool::len(), 1);
pool::run_one();
let mut t = task::spawn(file.flush());
assert_ready_ok!(t.poll());
}
#[test]
fn incomplete_read_fol... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 8a7e57786a5dca139f5b4261685e22991ded0859 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/tests/fs_file_mocked.rs | 401 | 460 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:12 | let (mock, file) = sys::File::mock();
mock.write(HELLO).write(FOO);
let mut file = File::from_std(file);
let mut t = task::spawn(file.write(HELLO));
let n = assert_ready_ok!(t.poll());
assert_eq!(n, HELLO.len());
let mut t = task::spawn(file.flush());
assert_pending!(t.poll());
// TO... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 8a7e57786a5dca139f5b4261685e22991ded0859 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/tests/fs_file_mocked.rs | 441 | 500 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:13 | }
#[test]
fn write_write_err() {
let (mock, file) = sys::File::mock();
mock.write_err();
let mut file = File::from_std(file);
let mut t = task::spawn(file.write(HELLO));
assert_ready_ok!(t.poll());
pool::run_one();
let mut t = task::spawn(file.write(FOO));
assert_ready_err!(t.poll()... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 8a7e57786a5dca139f5b4261685e22991ded0859 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/tests/fs_file_mocked.rs | 481 | 540 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:14 | #[test]
fn write_read_flush_err() {
let (mock, file) = sys::File::mock();
mock.write_err().read(HELLO);
let mut file = File::from_std(file);
let mut t = task::spawn(file.write(HELLO));
assert_ready_ok!(t.poll());
pool::run_one();
let mut buf = [0; 1024];
let mut t = task::spawn(file.... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 8a7e57786a5dca139f5b4261685e22991ded0859 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/tests/fs_file_mocked.rs | 521 | 580 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:15 | pool::run_one();
let mut t = task::spawn(file.write(FOO));
assert_ready_err!(t.poll());
}
#[test]
fn write_seek_flush_err() {
let (mock, file) = sys::File::mock();
mock.write_err().seek_start_ok(0);
let mut file = File::from_std(file);
let mut t = task::spawn(file.write(HELLO));
assert_r... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 8a7e57786a5dca139f5b4261685e22991ded0859 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/tests/fs_file_mocked.rs | 561 | 620 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:16 | assert_pending!(t.poll());
assert_eq!(1, pool::len());
pool::run_one();
assert!(t.is_woken());
assert_pending!(t.poll());
assert_eq!(1, pool::len());
pool::run_one();
assert!(t.is_woken());
assert_ready_ok!(t.poll());
}
#[test]
fn sync_all_err_ordered_after_write() {
let (mock, ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 8a7e57786a5dca139f5b4261685e22991ded0859 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/tests/fs_file_mocked.rs | 601 | 660 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:17 | #[test]
fn sync_data_ordered_after_write() {
let (mock, file) = sys::File::mock();
mock.write(HELLO).sync_data();
let mut file = File::from_std(file);
let mut t = task::spawn(file.write(HELLO));
assert_ready_ok!(t.poll());
let mut t = task::spawn(file.sync_data());
assert_pending!(t.poll()... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 8a7e57786a5dca139f5b4261685e22991ded0859 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/tests/fs_file_mocked.rs | 641 | 700 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:18 | assert!(t.is_woken());
assert_pending!(t.poll());
assert_eq!(1, pool::len());
pool::run_one();
assert!(t.is_woken());
assert_ready_err!(t.poll());
}
#[test]
fn open_set_len_ok() {
let (mock, file) = sys::File::mock();
mock.set_len(123);
let mut file = File::from_std(file);
let mu... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 8a7e57786a5dca139f5b4261685e22991ded0859 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/tests/fs_file_mocked.rs | 681 | 740 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:19 | assert_eq!(0, mock.remaining());
assert!(t.is_woken());
assert_ready_err!(t.poll());
}
#[test]
fn partial_read_set_len_ok() {
let (mock, file) = sys::File::mock();
mock.read(HELLO)
.seek_current_ok(-14, 0)
.set_len(123)
.read(FOO);
let mut buf = [0; 32];
let mut file =... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 8a7e57786a5dca139f5b4261685e22991ded0859 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/tests/fs_file_mocked.rs | 721 | 760 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:1 | #![warn(rust_2018_idioms)]
// Load source
#[allow(warnings)]
#[path = "../src/fs/file.rs"]
mod file;
use file::File;
#[allow(warnings)]
#[path = "../src/fs/blocking.rs"]
mod blocking;
// Load mocked types
mod support {
pub(crate) mod mock_file;
pub(crate) mod mock_pool;
}
pub(crate) use support::mock_pool as... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 987ba7373cf95c570bf23768c6021f7a7508286e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/987ba7373cf95c570bf23768c6021f7a7508286e/tokio/tests/fs_file_mocked.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:2 | #[test]
fn open_read() {
let (mock, file) = sys::File::mock();
mock.read(HELLO);
let mut file = File::from_std(file);
let mut buf = [0; 1024];
let mut t = task::spawn(file.read(&mut buf));
assert_eq!(0, pool::len());
assert_pending!(t.poll());
assert_eq!(1, mock.remaining());
ass... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 987ba7373cf95c570bf23768c6021f7a7508286e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/987ba7373cf95c570bf23768c6021f7a7508286e/tokio/tests/fs_file_mocked.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:3 | assert_eq!(pool::len(), 1);
pool::run_one();
assert!(t.is_woken());
let n = assert_ready_ok!(t.poll());
assert_eq!(&buf[..n], HELLO);
}
#[test]
fn read_with_smaller_buf() {
let (mock, file) = sys::File::mock();
mock.read(HELLO);
let mut file = File::from_std(file);
{
let mut... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 987ba7373cf95c570bf23768c6021f7a7508286e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/987ba7373cf95c570bf23768c6021f7a7508286e/tokio/tests/fs_file_mocked.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:4 | }
#[test]
fn read_with_bigger_buf() {
let (mock, file) = sys::File::mock();
mock.read(&HELLO[..4]).read(&HELLO[4..]);
let mut file = File::from_std(file);
{
let mut buf = [0; 4];
let mut t = task::spawn(file.read(&mut buf));
assert_pending!(t.poll());
}
pool::run_one(... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 987ba7373cf95c570bf23768c6021f7a7508286e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/987ba7373cf95c570bf23768c6021f7a7508286e/tokio/tests/fs_file_mocked.rs | 121 | 180 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:5 | assert_eq!(0, pool::len());
}
#[test]
fn read_err_then_read_success() {
let (mock, file) = sys::File::mock();
mock.read_err().read(&HELLO);
let mut file = File::from_std(file);
{
let mut buf = [0; 32];
let mut t = task::spawn(file.read(&mut buf));
assert_pending!(t.poll());
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 987ba7373cf95c570bf23768c6021f7a7508286e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/987ba7373cf95c570bf23768c6021f7a7508286e/tokio/tests/fs_file_mocked.rs | 161 | 220 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:6 | let mut t = task::spawn(file.write(HELLO));
assert_eq!(0, pool::len());
assert_ready_ok!(t.poll());
assert_eq!(1, mock.remaining());
assert_eq!(1, pool::len());
pool::run_one();
assert_eq!(0, mock.remaining());
assert!(!t.is_woken());
let mut t = task::spawn(file.flush());
asser... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 987ba7373cf95c570bf23768c6021f7a7508286e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/987ba7373cf95c570bf23768c6021f7a7508286e/tokio/tests/fs_file_mocked.rs | 201 | 260 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:7 | data.push((i % 151) as u8);
}
let (mock, file) = sys::File::mock();
mock.read(&data[0..a])
.read(&data[a..b])
.read(&data[b..c])
.read(&data[c..]);
let mut file = File::from_std(file);
let mut actual = vec![0; d];
let mut pos = 0;
while pos < data.len() {
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 987ba7373cf95c570bf23768c6021f7a7508286e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/987ba7373cf95c570bf23768c6021f7a7508286e/tokio/tests/fs_file_mocked.rs | 241 | 300 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:8 | let mut data = vec![];
for i in 0..(d - 1) {
data.push((i % 151) as u8);
}
let (mock, file) = sys::File::mock();
mock.write(&data[0..a])
.write(&data[a..b])
.write(&data[b..c])
.write(&data[c..]);
let mut file = File::from_std(file);
let mut rem = &data[..];
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 987ba7373cf95c570bf23768c6021f7a7508286e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/987ba7373cf95c570bf23768c6021f7a7508286e/tokio/tests/fs_file_mocked.rs | 281 | 340 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:9 | fn write_twice_before_dispatch() {
let (mock, file) = sys::File::mock();
mock.write(HELLO).write(FOO);
let mut file = File::from_std(file);
let mut t = task::spawn(file.write(HELLO));
assert_ready_ok!(t.poll());
let mut t = task::spawn(file.write(FOO));
assert_pending!(t.poll());
ass... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 987ba7373cf95c570bf23768c6021f7a7508286e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/987ba7373cf95c570bf23768c6021f7a7508286e/tokio/tests/fs_file_mocked.rs | 321 | 380 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:10 | let mut t = task::spawn(file.read(&mut buf));
assert_pending!(t.poll());
pool::run_one();
let mut t = task::spawn(file.write(FOO));
assert_ready_ok!(t.poll());
assert_eq!(pool::len(), 1);
pool::run_one();
let mut t = task::spawn(file.flush());
assert_ready_ok!(t.poll());
}
#[test]
f... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 987ba7373cf95c570bf23768c6021f7a7508286e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/987ba7373cf95c570bf23768c6021f7a7508286e/tokio/tests/fs_file_mocked.rs | 361 | 420 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:11 | }
#[test]
fn incomplete_read_followed_by_flush() {
let (mock, file) = sys::File::mock();
mock.read(HELLO)
.seek_current_ok(-(HELLO.len() as i64), 0)
.write(FOO);
let mut file = File::from_std(file);
let mut buf = [0; 32];
let mut t = task::spawn(file.read(&mut buf));
assert_p... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 987ba7373cf95c570bf23768c6021f7a7508286e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/987ba7373cf95c570bf23768c6021f7a7508286e/tokio/tests/fs_file_mocked.rs | 401 | 460 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:12 | // TODO: Move under write
pool::run_one();
let mut t = task::spawn(file.write(FOO));
assert_ready_ok!(t.poll());
pool::run_one();
let mut t = task::spawn(file.flush());
assert_ready_ok!(t.poll());
}
#[test]
fn read_err() {
let (mock, file) = sys::File::mock();
mock.read_err();
l... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 987ba7373cf95c570bf23768c6021f7a7508286e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/987ba7373cf95c570bf23768c6021f7a7508286e/tokio/tests/fs_file_mocked.rs | 441 | 500 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:13 | pool::run_one();
let mut t = task::spawn(file.write(FOO));
assert_ready_err!(t.poll());
}
#[test]
fn write_read_write_err() {
let (mock, file) = sys::File::mock();
mock.write_err().read(HELLO);
let mut file = File::from_std(file);
let mut t = task::spawn(file.write(HELLO));
assert_ready_... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 987ba7373cf95c570bf23768c6021f7a7508286e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/987ba7373cf95c570bf23768c6021f7a7508286e/tokio/tests/fs_file_mocked.rs | 481 | 540 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:14 | pool::run_one();
let mut buf = [0; 1024];
let mut t = task::spawn(file.read(&mut buf));
assert_pending!(t.poll());
pool::run_one();
let mut t = task::spawn(file.flush());
assert_ready_err!(t.poll());
}
#[test]
fn write_seek_write_err() {
let (mock, file) = sys::File::mock();
mock.wr... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 987ba7373cf95c570bf23768c6021f7a7508286e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/987ba7373cf95c570bf23768c6021f7a7508286e/tokio/tests/fs_file_mocked.rs | 521 | 580 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:15 | let mut file = File::from_std(file);
let mut t = task::spawn(file.write(HELLO));
assert_ready_ok!(t.poll());
pool::run_one();
{
let mut t = task::spawn(file.seek(SeekFrom::Start(0)));
assert_pending!(t.poll());
}
pool::run_one();
let mut t = task::spawn(file.flush());
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 987ba7373cf95c570bf23768c6021f7a7508286e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/987ba7373cf95c570bf23768c6021f7a7508286e/tokio/tests/fs_file_mocked.rs | 561 | 620 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:16 | assert!(t.is_woken());
assert_ready_ok!(t.poll());
}
#[test]
fn sync_all_err_ordered_after_write() {
let (mock, file) = sys::File::mock();
mock.write(HELLO).sync_all_err();
let mut file = File::from_std(file);
let mut t = task::spawn(file.write(HELLO));
assert_ready_ok!(t.poll());
let mut... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file_mocked.rs | MIT | 987ba7373cf95c570bf23768c6021f7a7508286e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/987ba7373cf95c570bf23768c6021f7a7508286e/tokio/tests/fs_file_mocked.rs | 601 | 660 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.