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/enumerate.rs:1 | #![deny(warnings, rust_2018_idioms)]
use futures::sync::mpsc;
use tokio::util::StreamExt;
#[test]
fn enumerate() {
use futures::*;
let (mut tx, rx) = mpsc::channel(1);
std::thread::spawn(|| {
for i in 0..5 {
tx = tx.send(i * 2).wait().unwrap();
}
});
let result = rx.... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/enumerate.rs | MIT | cb4aea394e6851ae8cc45a68beeaf2c93cc9a0c0 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/cb4aea394e6851ae8cc45a68beeaf2c93cc9a0c0/tokio/tests/enumerate.rs | 1 | 23 |
tokio-rs/tokio:tokio/tests/fs.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi does not support file operations
use tokio::fs;
use tokio_test::assert_ok;
#[tokio::test]
async fn path_read_write() {
let temp = tempdir();
let dir = temp.path();
assert_ok!(fs::write(dir.join("bar"), b"bytes").aw... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/fs.rs | 1 | 36 |
tokio-rs/tokio:tokio/tests/fs.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi does not support file operations
use tokio::fs;
use tokio_test::assert_ok;
#[tokio::test]
async fn path_read_write() {
let temp = tempdir();
let dir = temp.path();
assert_ok!(fs::write(dir.join("bar"), b"bytes").aw... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs.rs | MIT | c445e467ce4363b3a9b6825268814a9bc27c0127 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/fs.rs | 1 | 20 |
tokio-rs/tokio:tokio/tests/fs.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(tokio_wasi)))] // Wasi does not support file operations
use tokio::fs;
use tokio_test::assert_ok;
#[tokio::test]
async fn path_read_write() {
let temp = tempdir();
let dir = temp.path();
assert_ok!(fs::write(dir.join("bar"), b"bytes").await);
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs.rs | MIT | b2ada60e701d5c9e6644cf8fc42a100774f8e23f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b2ada60e701d5c9e6644cf8fc42a100774f8e23f/tokio/tests/fs.rs | 1 | 20 |
tokio-rs/tokio:tokio/tests/fs.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use tokio::fs;
use tokio_test::assert_ok;
#[tokio::test]
async fn path_read_write() {
let temp = tempdir();
let dir = temp.path();
assert_ok!(fs::write(dir.join("bar"), b"bytes").await);
let out = assert_ok!(fs::read(dir.join("bar")).await);
a... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs.rs | MIT | a2cfc877a7f45eb0e1ae8d2775e22ee91da725ec | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a2cfc877a7f45eb0e1ae8d2775e22ee91da725ec/tokio/tests/fs.rs | 1 | 20 |
tokio-rs/tokio:tokio/tests/fs_canonicalize_dir.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi")))] // WASI does not support all fs operations
use tokio::fs;
#[tokio::test]
#[cfg(unix)]
async fn canonicalize_root_dir_unix() {
assert_eq!(fs::canonicalize("/.").await.unwrap().to_str().unwrap(), "/");
}
#[tokio::test]
#[cfg(windows... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_canonicalize_dir.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/fs_canonicalize_dir.rs | 1 | 22 |
tokio-rs/tokio:tokio/tests/fs_canonicalize_dir.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(tokio_wasi)))] // WASI does not support all fs operations
use tokio::fs;
#[tokio::test]
#[cfg(unix)]
async fn canonicalize_root_dir_unix() {
assert_eq!(fs::canonicalize("/.").await.unwrap().to_str().unwrap(), "/");
}
#[tokio::test]
#[cfg(windows)]
async... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_canonicalize_dir.rs | MIT | cadcd5da5ea4649b978c247ca11f270ddf54fa04 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/cadcd5da5ea4649b978c247ca11f270ddf54fa04/tokio/tests/fs_canonicalize_dir.rs | 1 | 22 |
tokio-rs/tokio:tokio/tests/fs_copy.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi")))] // WASI does not support all fs operations
use tempfile::tempdir;
use tokio::fs;
#[tokio::test]
#[cfg_attr(miri, ignore)] // No `fchmod` in miri.
async fn copy() {
let dir = tempdir().unwrap();
let source_path = dir.path().joi... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_copy.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/fs_copy.rs | 1 | 41 |
tokio-rs/tokio:tokio/tests/fs_copy.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi")))] // WASI does not support all fs operations
use tempfile::tempdir;
use tokio::fs;
#[tokio::test]
#[cfg_attr(miri, ignore)]
async fn copy() {
let dir = tempdir().unwrap();
let source_path = dir.path().join("foo.txt");
let de... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_copy.rs | MIT | 161b8c80d58a4a070c7f41db18d43ea258737db7 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/161b8c80d58a4a070c7f41db18d43ea258737db7/tokio/tests/fs_copy.rs | 1 | 41 |
tokio-rs/tokio:tokio/tests/fs_copy.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi")))] // WASI does not support all fs operations
use tempfile::tempdir;
use tokio::fs;
#[tokio::test]
async fn copy() {
let dir = tempdir().unwrap();
let source_path = dir.path().join("foo.txt");
let dest_path = dir.path().join(... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_copy.rs | MIT | c445e467ce4363b3a9b6825268814a9bc27c0127 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/fs_copy.rs | 1 | 39 |
tokio-rs/tokio:tokio/tests/fs_copy.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(tokio_wasi)))] // WASI does not support all fs operations
use tempfile::tempdir;
use tokio::fs;
#[tokio::test]
async fn copy() {
let dir = tempdir().unwrap();
let source_path = dir.path().join("foo.txt");
let dest_path = dir.path().join("bar.txt... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_copy.rs | MIT | cadcd5da5ea4649b978c247ca11f270ddf54fa04 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/cadcd5da5ea4649b978c247ca11f270ddf54fa04/tokio/tests/fs_copy.rs | 1 | 39 |
tokio-rs/tokio:tokio/tests/fs_copy.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(tokio_wasi)))] // Wasi does not support file operations
use tempfile::tempdir;
use tokio::fs;
#[tokio::test]
async fn copy() {
let dir = tempdir().unwrap();
let source_path = dir.path().join("foo.txt");
let dest_path = dir.path().join("bar.txt")... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_copy.rs | MIT | b2ada60e701d5c9e6644cf8fc42a100774f8e23f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b2ada60e701d5c9e6644cf8fc42a100774f8e23f/tokio/tests/fs_copy.rs | 1 | 39 |
tokio-rs/tokio:tokio/tests/fs_copy.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi does not support file operations
use tempfile::tempdir;
use tokio::fs;
#[tokio::test]
async fn copy() {
let dir = tempdir().unwrap();
let source_path = dir.path().join("foo.txt");
let dest_path = dir.path().join("b... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_copy.rs | MIT | 6d3f92dddc510e9276191cfab1b0432ce8248589 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6d3f92dddc510e9276191cfab1b0432ce8248589/tokio/tests/fs_copy.rs | 1 | 39 |
tokio-rs/tokio:tokio/tests/fs_copy.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use tempfile::tempdir;
use tokio::fs;
#[tokio::test]
async fn copy() {
let dir = tempdir().unwrap();
let source_path = dir.path().join("foo.txt");
let dest_path = dir.path().join("bar.txt");
fs::write(&source_path, b"Hello File!").await.unwrap();
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_copy.rs | MIT | 3eaa1885c314345f3fa0022e8a04af4f159f2365 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3eaa1885c314345f3fa0022e8a04af4f159f2365/tokio/tests/fs_copy.rs | 1 | 39 |
tokio-rs/tokio:tokio/tests/fs_copy.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use tempfile::tempdir;
use tokio::fs;
#[tokio::test]
async fn copy() {
let dir = tempdir().unwrap();
let source_path = dir.path().join("foo.txt");
let dest_path = dir.path().join("bar.txt");
fs::write(&source_path, b"Hello File!").await.unwrap();
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_copy.rs | MIT | bc8dcdeb58dfca234d85b2a93a7a20af738f48a2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/bc8dcdeb58dfca234d85b2a93a7a20af738f48a2/tokio/tests/fs_copy.rs | 1 | 21 |
tokio-rs/tokio:tokio/tests/fs_copy.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use tokio::fs;
#[tokio::test]
async fn copy() {
fs::write("foo.txt", b"Hello File!").await.unwrap();
fs::copy("foo.txt", "bar.txt").await.unwrap();
let from = fs::read("foo.txt").await.unwrap();
let to = fs::read("bar.txt").await.unwrap();
ass... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_copy.rs | MIT | f0bfebb7e1b1b7e86857781a6d730679b9761daf | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f0bfebb7e1b1b7e86857781a6d730679b9761daf/tokio/tests/fs_copy.rs | 1 | 15 |
tokio-rs/tokio:tokio/tests/fs_dir.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi")))] // WASI does not support all fs operations
use tokio::fs;
use tokio_test::{assert_err, assert_ok};
use std::sync::{Arc, Mutex};
use tempfile::tempdir;
#[tokio::test]
async fn create_dir() {
let base_dir = tempdir().unwrap();
l... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_dir.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/fs_dir.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/fs_dir.rs:2 | fs::DirBuilder::new()
.recursive(false)
.create(new_dir_2)
.await
);
}
#[tokio::test]
#[cfg(unix)]
async fn build_dir_mode_read_only() {
let base_dir = tempdir().unwrap();
let new_dir = base_dir.path().join("abc");
assert_ok!(
fs::DirBuilder::new()
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_dir.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/fs_dir.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/fs_dir.rs:3 | #[tokio::test]
async fn read_inherent() {
let base_dir = tempdir().unwrap();
let p = base_dir.path();
std::fs::create_dir(p.join("aa")).unwrap();
std::fs::create_dir(p.join("bb")).unwrap();
std::fs::create_dir(p.join("cc")).unwrap();
let files = Arc::new(Mutex::new(Vec::new()));
let f = f... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_dir.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/fs_dir.rs | 81 | 126 |
tokio-rs/tokio:tokio/tests/fs_dir.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(tokio_wasi)))] // WASI does not support all fs operations
use tokio::fs;
use tokio_test::{assert_err, assert_ok};
use std::sync::{Arc, Mutex};
use tempfile::tempdir;
#[tokio::test]
async fn create_dir() {
let base_dir = tempdir().unwrap();
let new_d... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_dir.rs | MIT | cadcd5da5ea4649b978c247ca11f270ddf54fa04 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/cadcd5da5ea4649b978c247ca11f270ddf54fa04/tokio/tests/fs_dir.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/fs_dir.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(tokio_wasi)))] // Wasi does not support directory operations
use tokio::fs;
use tokio_test::{assert_err, assert_ok};
use std::sync::{Arc, Mutex};
use tempfile::tempdir;
#[tokio::test]
async fn create_dir() {
let base_dir = tempdir().unwrap();
let ne... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_dir.rs | MIT | b2ada60e701d5c9e6644cf8fc42a100774f8e23f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b2ada60e701d5c9e6644cf8fc42a100774f8e23f/tokio/tests/fs_dir.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/fs_dir.rs:2 | fs::DirBuilder::new()
.recursive(false)
.create(new_dir_2)
.await
);
}
#[tokio::test]
async fn remove() {
let base_dir = tempdir().unwrap();
let new_dir = base_dir.path().join("foo");
let new_dir_2 = new_dir.clone();
std::fs::create_dir(new_dir.clone()).unwrap()... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_dir.rs | MIT | b2ada60e701d5c9e6644cf8fc42a100774f8e23f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b2ada60e701d5c9e6644cf8fc42a100774f8e23f/tokio/tests/fs_dir.rs | 41 | 87 |
tokio-rs/tokio:tokio/tests/fs_dir.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi does not support directory operations
use tokio::fs;
use tokio_test::{assert_err, assert_ok};
use std::sync::{Arc, Mutex};
use tempfile::tempdir;
#[tokio::test]
async fn create_dir() {
let base_dir = tempdir().unwrap();
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_dir.rs | MIT | 6d3f92dddc510e9276191cfab1b0432ce8248589 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6d3f92dddc510e9276191cfab1b0432ce8248589/tokio/tests/fs_dir.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/fs_dir.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use tokio::fs;
use tokio_test::{assert_err, assert_ok};
use std::sync::{Arc, Mutex};
use tempfile::tempdir;
#[tokio::test]
async fn create_dir() {
let base_dir = tempdir().unwrap();
let new_dir = base_dir.path().join("foo");
let new_dir_2 = new_dir.clo... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_dir.rs | MIT | 8efa62013b551d5130791c3a79ce8ab5cb0b5abf | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8efa62013b551d5130791c3a79ce8ab5cb0b5abf/tokio/tests/fs_dir.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/fs_dir.rs:2 | fs::DirBuilder::new()
.recursive(false)
.create(new_dir_2)
.await
);
}
#[tokio::test]
async fn remove() {
let base_dir = tempdir().unwrap();
let new_dir = base_dir.path().join("foo");
let new_dir_2 = new_dir.clone();
std::fs::create_dir(new_dir.clone()).unwrap()... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_dir.rs | MIT | 8fda5f1984e5c56548ea5bb0cf7d0f5c57c3a190 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8fda5f1984e5c56548ea5bb0cf7d0f5c57c3a190/tokio/tests/fs_dir.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/fs_dir.rs:3 | let mut files = files.lock().unwrap();
files.sort(); // because the order is not guaranteed
assert_eq!(
*files,
vec!["aa".to_string(), "bb".to_string(), "cc".to_string()]
);
}
#[tokio::test]
async fn read_stream() {
use tokio::stream::StreamExt;
let base_dir = tempdir().unwrap();
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_dir.rs | MIT | 8fda5f1984e5c56548ea5bb0cf7d0f5c57c3a190 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8fda5f1984e5c56548ea5bb0cf7d0f5c57c3a190/tokio/tests/fs_dir.rs | 81 | 119 |
tokio-rs/tokio:tokio/tests/fs_dir.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use tokio::fs;
use tokio_test::assert_ok;
use std::sync::{Arc, Mutex};
use tempfile::tempdir;
#[tokio::test]
async fn create_dir() {
let base_dir = tempdir().unwrap();
let new_dir = base_dir.path().join("foo");
let new_dir_2 = new_dir.clone();
ass... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_dir.rs | MIT | 4c645866ef4ea5b0ef8c7852281a09b2f96d969b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4c645866ef4ea5b0ef8c7852281a09b2f96d969b/tokio/tests/fs_dir.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/fs_dir.rs:2 | }
#[tokio::test]
async fn read_inherent() {
let base_dir = tempdir().unwrap();
let p = base_dir.path();
std::fs::create_dir(p.join("aa")).unwrap();
std::fs::create_dir(p.join("bb")).unwrap();
std::fs::create_dir(p.join("cc")).unwrap();
let files = Arc::new(Mutex::new(Vec::new()));
let f ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_dir.rs | MIT | 4c645866ef4ea5b0ef8c7852281a09b2f96d969b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4c645866ef4ea5b0ef8c7852281a09b2f96d969b/tokio/tests/fs_dir.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/fs_dir.rs:3 | std::fs::create_dir(p.join("cc")).unwrap();
let files = Arc::new(Mutex::new(Vec::new()));
let f = files.clone();
let p = p.to_path_buf();
let mut entries = fs::read_dir(p).await.unwrap();
while let Some(res) = entries.next().await {
let e = assert_ok!(res);
let s = e.file_name().... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_dir.rs | MIT | 4c645866ef4ea5b0ef8c7852281a09b2f96d969b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4c645866ef4ea5b0ef8c7852281a09b2f96d969b/tokio/tests/fs_dir.rs | 81 | 102 |
tokio-rs/tokio:tokio/tests/fs_dir.rs:2 | }
#[tokio::test]
async fn read_inherent() {
let base_dir = tempdir().unwrap();
let p = base_dir.path();
std::fs::create_dir(p.join("aa")).unwrap();
std::fs::create_dir(p.join("bb")).unwrap();
std::fs::create_dir(p.join("cc")).unwrap();
let files = Arc::new(Mutex::new(Vec::new()));
let f ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_dir.rs | MIT | 7b4c999341809588a427a9a80d310ee4aa1c1a21 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7b4c999341809588a427a9a80d310ee4aa1c1a21/tokio/tests/fs_dir.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/fs_dir.rs:1 | #![warn(rust_2018_idioms)]
use tokio::fs;
use tokio_test::assert_ok;
use std::sync::{Arc, Mutex};
use tempfile::tempdir;
#[tokio::test]
async fn create_dir() {
let base_dir = tempdir().unwrap();
let new_dir = base_dir.path().join("foo");
let new_dir_2 = new_dir.clone();
assert_ok!(fs::create_dir(new... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_dir.rs | MIT | 8a7e57786a5dca139f5b4261685e22991ded0859 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/tests/fs_dir.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/fs_dir.rs:2 | #[tokio::test]
async fn read_inherent() {
let base_dir = tempdir().unwrap();
let p = base_dir.path();
std::fs::create_dir(p.join("aa")).unwrap();
std::fs::create_dir(p.join("bb")).unwrap();
std::fs::create_dir(p.join("cc")).unwrap();
let files = Arc::new(Mutex::new(Vec::new()));
let f = f... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_dir.rs | MIT | 8a7e57786a5dca139f5b4261685e22991ded0859 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/tests/fs_dir.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/fs_dir.rs:3 | let files = Arc::new(Mutex::new(Vec::new()));
let f = files.clone();
let p = p.to_path_buf();
let mut entries = fs::read_dir(p).await.unwrap();
while let Some(res) = entries.next().await {
let e = assert_ok!(res);
let s = e.file_name().to_str().unwrap().to_string();
f.lock().u... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_dir.rs | MIT | 8a7e57786a5dca139f5b4261685e22991ded0859 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8a7e57786a5dca139f5b4261685e22991ded0859/tokio/tests/fs_dir.rs | 81 | 101 |
tokio-rs/tokio:tokio/tests/fs_dir.rs:1 | #![warn(rust_2018_idioms)]
use tokio::fs;
use tokio_test::assert_ok;
use futures_util::future;
use futures_util::stream::TryStreamExt;
use std::sync::{Arc, Mutex};
use tempfile::tempdir;
#[tokio::test]
async fn create_dir() {
let base_dir = tempdir().unwrap();
let new_dir = base_dir.path().join("foo");
l... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_dir.rs | MIT | 6f8b986bdb61843171ab90a1947349d5ac25576e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6f8b986bdb61843171ab90a1947349d5ac25576e/tokio/tests/fs_dir.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/fs_dir.rs:2 | assert!(!new_dir_2.exists());
}
#[tokio::test]
async fn read() {
let base_dir = tempdir().unwrap();
let p = base_dir.path();
std::fs::create_dir(p.join("aa")).unwrap();
std::fs::create_dir(p.join("bb")).unwrap();
std::fs::create_dir(p.join("cc")).unwrap();
let files = Arc::new(Mutex::new(Vec:... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_dir.rs | MIT | 6f8b986bdb61843171ab90a1947349d5ac25576e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6f8b986bdb61843171ab90a1947349d5ac25576e/tokio/tests/fs_dir.rs | 41 | 74 |
tokio-rs/tokio:tokio/tests/fs_file.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi")))] // WASI does not support all fs operations
use futures::future::FutureExt;
use std::io::prelude::*;
use std::io::IoSlice;
use tempfile::NamedTempFile;
use tokio::fs::File;
use tokio::io::{AsyncReadExt, AsyncSeekExt, AsyncWriteExt, SeekF... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/fs_file.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/fs_file.rs:2 | #[tokio::test]
async fn basic_write_and_shutdown() {
let tempfile = tempfile();
let mut file = File::create(tempfile.path()).await.unwrap();
file.write_all(HELLO).await.unwrap();
file.shutdown().await.unwrap();
let file = std::fs::read(tempfile.path()).unwrap();
assert_eq!(file, HELLO);
}
#[... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/fs_file.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/fs_file.rs:3 | assert_eq!(ret, HELLO.len() * 2);
file.shutdown().await.unwrap();
let file = std::fs::read(tempfile.path()).unwrap();
assert_eq!(file, [HELLO, HELLO].concat());
}
#[tokio::test]
async fn rewind_seek_position() {
let tempfile = tempfile();
let mut file = File::create(tempfile.path()).await.unwrap(... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/fs_file.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/fs_file.rs:4 | }
panic!("did not yield");
}
#[tokio::test]
async fn write_to_clone() {
let tempfile = tempfile();
let file = File::create(tempfile.path()).await.unwrap();
let mut clone = file.try_clone().await.unwrap();
clone.write_all(HELLO).await.unwrap();
clone.flush().await.unwrap();
let contents ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/fs_file.rs | 121 | 180 |
tokio-rs/tokio:tokio/tests/fs_file.rs:5 | let contents = std::fs::read(tempfile.path()).unwrap();
assert_eq!(contents, HELLO);
}
#[tokio::test]
async fn read_file_from_std() {
let mut tempfile = tempfile();
tempfile.write_all(HELLO).unwrap();
let std_file = std::fs::File::open(tempfile.path()).unwrap();
let mut file = File::from(std_file)... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/fs_file.rs | 161 | 220 |
tokio-rs/tokio:tokio/tests/fs_file.rs:6 | #[tokio::test]
async fn set_max_buf_size_read() {
let mut tempfile = tempfile();
tempfile.write_all(HELLO).unwrap();
let mut file = File::open(tempfile.path()).await.unwrap();
let mut buf = [0; 1024];
file.set_max_buf_size(1);
// A single read operation reads a maximum of 1 byte.
assert_eq!... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/fs_file.rs | 201 | 260 |
tokio-rs/tokio:tokio/tests/fs_file.rs:7 | let tempfile = tempfile();
let file = File::open(tempfile.path()).await.unwrap();
assert_eq!(
&format!("{:?}", file)[0..37],
"tokio::fs::File { std: File { handle:"
);
}
#[tokio::test]
#[cfg(unix)]
async fn unix_fd_is_valid() {
use std::os::unix::io::AsRawFd;
let tempfile = tempfi... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/tests/fs_file.rs | 241 | 289 |
tokio-rs/tokio:tokio/tests/fs_file.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi")))] // WASI does not support all fs operations
use std::io::prelude::*;
use std::io::IoSlice;
use tempfile::NamedTempFile;
use tokio::fs::File;
use tokio::io::{AsyncReadExt, AsyncSeekExt, AsyncWriteExt, SeekFrom};
use tokio_test::task;
con... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file.rs | MIT | d4178cf34924d14fca4ecf551c97b8953376f25a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d4178cf34924d14fca4ecf551c97b8953376f25a/tokio/tests/fs_file.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/fs_file.rs:2 | async fn basic_write_and_shutdown() {
let tempfile = tempfile();
let mut file = File::create(tempfile.path()).await.unwrap();
file.write_all(HELLO).await.unwrap();
file.shutdown().await.unwrap();
let file = std::fs::read(tempfile.path()).unwrap();
assert_eq!(file, HELLO);
}
#[tokio::test]
as... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file.rs | MIT | d4178cf34924d14fca4ecf551c97b8953376f25a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d4178cf34924d14fca4ecf551c97b8953376f25a/tokio/tests/fs_file.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/fs_file.rs:3 | file.shutdown().await.unwrap();
let file = std::fs::read(tempfile.path()).unwrap();
assert_eq!(file, [HELLO, HELLO].concat());
}
#[tokio::test]
async fn rewind_seek_position() {
let tempfile = tempfile();
let mut file = File::create(tempfile.path()).await.unwrap();
file.seek(SeekFrom::Current(10... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file.rs | MIT | d4178cf34924d14fca4ecf551c97b8953376f25a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d4178cf34924d14fca4ecf551c97b8953376f25a/tokio/tests/fs_file.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/fs_file.rs:4 | panic!("did not yield");
}
#[tokio::test]
async fn write_to_clone() {
let tempfile = tempfile();
let file = File::create(tempfile.path()).await.unwrap();
let mut clone = file.try_clone().await.unwrap();
clone.write_all(HELLO).await.unwrap();
clone.flush().await.unwrap();
let contents = std::... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file.rs | MIT | d4178cf34924d14fca4ecf551c97b8953376f25a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d4178cf34924d14fca4ecf551c97b8953376f25a/tokio/tests/fs_file.rs | 121 | 180 |
tokio-rs/tokio:tokio/tests/fs_file.rs:5 | let contents = std::fs::read(tempfile.path()).unwrap();
assert_eq!(contents, HELLO);
}
#[tokio::test]
async fn read_file_from_std() {
let mut tempfile = tempfile();
tempfile.write_all(HELLO).unwrap();
let std_file = std::fs::File::open(tempfile.path()).unwrap();
let mut file = File::from(std_file)... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file.rs | MIT | d4178cf34924d14fca4ecf551c97b8953376f25a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d4178cf34924d14fca4ecf551c97b8953376f25a/tokio/tests/fs_file.rs | 161 | 220 |
tokio-rs/tokio:tokio/tests/fs_file.rs:6 | // A single write operation writes a maximum of 1 byte.
assert_eq!(file.write(HELLO).await.unwrap(), 1);
}
#[tokio::test]
#[cfg_attr(miri, ignore)]
#[cfg(unix)]
async fn file_debug_fmt() {
let tempfile = tempfile();
let file = File::open(tempfile.path()).await.unwrap();
assert_eq!(
&format!("... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file.rs | MIT | d4178cf34924d14fca4ecf551c97b8953376f25a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d4178cf34924d14fca4ecf551c97b8953376f25a/tokio/tests/fs_file.rs | 201 | 260 |
tokio-rs/tokio:tokio/tests/fs_file.rs:7 | #[tokio::test]
#[cfg(unix)]
async fn read_file_from_unix_fd() {
use std::os::unix::io::{FromRawFd, IntoRawFd};
let mut tempfile = tempfile();
tempfile.write_all(HELLO).unwrap();
let file1 = File::open(tempfile.path()).await.unwrap();
let raw_fd = file1.into_std().await.into_raw_fd();
assert!(r... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file.rs | MIT | d4178cf34924d14fca4ecf551c97b8953376f25a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d4178cf34924d14fca4ecf551c97b8953376f25a/tokio/tests/fs_file.rs | 241 | 270 |
tokio-rs/tokio:tokio/tests/fs_file.rs:5 | let contents = std::fs::read(tempfile.path()).unwrap();
assert_eq!(contents, HELLO);
}
#[tokio::test]
async fn read_file_from_std() {
let mut tempfile = tempfile();
tempfile.write_all(HELLO).unwrap();
let std_file = std::fs::File::open(tempfile.path()).unwrap();
let mut file = File::from(std_file)... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file.rs | MIT | 161b8c80d58a4a070c7f41db18d43ea258737db7 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/161b8c80d58a4a070c7f41db18d43ea258737db7/tokio/tests/fs_file.rs | 161 | 220 |
tokio-rs/tokio:tokio/tests/fs_file.rs:6 | // A single write operation writes a maximum of 1 byte.
assert_eq!(file.write(HELLO).await.unwrap(), 1);
}
#[tokio::test]
#[cfg_attr(miri, ignore)]
#[cfg(unix)]
async fn file_debug_fmt() {
let tempfile = tempfile();
let file = File::open(tempfile.path()).await.unwrap();
assert_eq!(
&format!("... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file.rs | MIT | 161b8c80d58a4a070c7f41db18d43ea258737db7 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/161b8c80d58a4a070c7f41db18d43ea258737db7/tokio/tests/fs_file.rs | 201 | 260 |
tokio-rs/tokio:tokio/tests/fs_file.rs:5 | let contents = std::fs::read(tempfile.path()).unwrap();
assert_eq!(contents, HELLO);
}
#[tokio::test]
async fn read_file_from_std() {
let mut tempfile = tempfile();
tempfile.write_all(HELLO).unwrap();
let std_file = std::fs::File::open(tempfile.path()).unwrap();
let mut file = File::from(std_file)... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file.rs | MIT | f9d78fbe924f2255cbc8a8fc256767813b6451dc | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f9d78fbe924f2255cbc8a8fc256767813b6451dc/tokio/tests/fs_file.rs | 161 | 220 |
tokio-rs/tokio:tokio/tests/fs_file.rs:6 | // A single write operation writes a maximum of 1 byte.
assert_eq!(file.write(HELLO).await.unwrap(), 1);
}
#[tokio::test]
#[cfg(unix)]
async fn file_debug_fmt() {
let tempfile = tempfile();
let file = File::open(tempfile.path()).await.unwrap();
assert_eq!(
&format!("{:?}", file)[0..33],
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file.rs | MIT | f9d78fbe924f2255cbc8a8fc256767813b6451dc | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f9d78fbe924f2255cbc8a8fc256767813b6451dc/tokio/tests/fs_file.rs | 201 | 260 |
tokio-rs/tokio:tokio/tests/fs_file.rs:5 | let contents = std::fs::read(tempfile.path()).unwrap();
assert_eq!(contents, HELLO);
}
#[tokio::test]
async fn read_file_from_std() {
let mut tempfile = tempfile();
tempfile.write_all(HELLO).unwrap();
let std_file = std::fs::File::open(tempfile.path()).unwrap();
let mut file = File::from(std_file)... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file.rs | MIT | 37bb47c4a2aff8913e536767645772f15650e6cd | github | async-runtime | https://github.com/tokio-rs/tokio/blob/37bb47c4a2aff8913e536767645772f15650e6cd/tokio/tests/fs_file.rs | 161 | 220 |
tokio-rs/tokio:tokio/tests/fs_file.rs:6 | let file = File::open(tempfile.path()).await.unwrap();
assert_eq!(
&format!("{:?}", file)[0..37],
"tokio::fs::File { std: File { handle:"
);
}
#[tokio::test]
#[cfg(unix)]
async fn unix_fd_is_valid() {
use std::os::unix::io::AsRawFd;
let tempfile = tempfile();
let file = File::crea... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file.rs | MIT | 37bb47c4a2aff8913e536767645772f15650e6cd | github | async-runtime | https://github.com/tokio-rs/tokio/blob/37bb47c4a2aff8913e536767645772f15650e6cd/tokio/tests/fs_file.rs | 201 | 247 |
tokio-rs/tokio:tokio/tests/fs_file.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi")))] // WASI does not support all fs operations
use std::io::prelude::*;
use tempfile::NamedTempFile;
use tokio::fs::File;
use tokio::io::{AsyncReadExt, AsyncSeekExt, AsyncWriteExt, SeekFrom};
use tokio_test::task;
const HELLO: &[u8] = b"he... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file.rs | MIT | c445e467ce4363b3a9b6825268814a9bc27c0127 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/fs_file.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/fs_file.rs:2 | let tempfile = tempfile();
let mut file = File::create(tempfile.path()).await.unwrap();
file.write_all(HELLO).await.unwrap();
file.shutdown().await.unwrap();
let file = std::fs::read(tempfile.path()).unwrap();
assert_eq!(file, HELLO);
}
#[tokio::test]
async fn rewind_seek_position() {
let te... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file.rs | MIT | c445e467ce4363b3a9b6825268814a9bc27c0127 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/fs_file.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/fs_file.rs:3 | for _ in 0..1_000 {
if task.poll().is_pending() {
return;
}
}
panic!("did not yield");
}
#[tokio::test]
async fn write_to_clone() {
let tempfile = tempfile();
let file = File::create(tempfile.path()).await.unwrap();
let mut clone = file.try_clone().await.unwrap();
... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file.rs | MIT | c445e467ce4363b3a9b6825268814a9bc27c0127 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/fs_file.rs | 81 | 140 |
tokio-rs/tokio:tokio/tests/fs_file.rs:4 | let file = File::create(tempfile.path()).await.unwrap();
let mut std_file = file.try_into_std().unwrap();
std_file.write_all(HELLO).unwrap();
let contents = std::fs::read(tempfile.path()).unwrap();
assert_eq!(contents, HELLO);
}
#[tokio::test]
async fn read_file_from_std() {
let mut tempfile = te... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file.rs | MIT | c445e467ce4363b3a9b6825268814a9bc27c0127 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/fs_file.rs | 121 | 180 |
tokio-rs/tokio:tokio/tests/fs_file.rs:5 | #[tokio::test]
#[cfg(windows)]
async fn file_debug_fmt() {
let tempfile = tempfile();
let file = File::open(tempfile.path()).await.unwrap();
assert_eq!(
&format!("{:?}", file)[0..37],
"tokio::fs::File { std: File { handle:"
);
}
#[tokio::test]
#[cfg(unix)]
async fn unix_fd_is_valid() ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file.rs | MIT | c445e467ce4363b3a9b6825268814a9bc27c0127 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/fs_file.rs | 161 | 212 |
tokio-rs/tokio:tokio/tests/fs_file.rs:6 | assert_eq!(&buf[..n], HELLO);
}
#[tokio::test]
#[cfg(windows)]
async fn windows_handle() {
use std::os::windows::io::AsRawHandle;
let tempfile = tempfile();
let file = File::create(tempfile.path()).await.unwrap();
assert!(file.as_raw_handle() as u64 > 0);
} | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file.rs | MIT | c445e467ce4363b3a9b6825268814a9bc27c0127 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/tests/fs_file.rs | 201 | 212 |
tokio-rs/tokio:tokio/tests/fs_file.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(tokio_wasi)))] // WASI does not support all fs operations
use std::io::prelude::*;
use tempfile::NamedTempFile;
use tokio::fs::File;
use tokio::io::{AsyncReadExt, AsyncSeekExt, AsyncWriteExt, SeekFrom};
use tokio_test::task;
const HELLO: &[u8] = b"hello worl... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file.rs | MIT | ff2f286c120680f03182082a3fb97d69cd71d27d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ff2f286c120680f03182082a3fb97d69cd71d27d/tokio/tests/fs_file.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/fs_file.rs:5 | #[tokio::test]
#[cfg(windows)]
async fn file_debug_fmt() {
let tempfile = tempfile();
let file = File::open(tempfile.path()).await.unwrap();
assert_eq!(
&format!("{:?}", file)[0..37],
"tokio::fs::File { std: File { handle:"
);
}
#[tokio::test]
#[cfg(unix)]
async fn unix_fd_is_valid() ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file.rs | MIT | cadcd5da5ea4649b978c247ca11f270ddf54fa04 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/cadcd5da5ea4649b978c247ca11f270ddf54fa04/tokio/tests/fs_file.rs | 161 | 213 |
tokio-rs/tokio:tokio/tests/fs_file.rs:6 | assert_eq!(n, HELLO.len());
assert_eq!(&buf[..n], HELLO);
}
#[tokio::test]
#[cfg(windows)]
async fn windows_handle() {
use std::os::windows::io::AsRawHandle;
let tempfile = tempfile();
let file = File::create(tempfile.path()).await.unwrap();
assert!(file.as_raw_handle() as u64 > 0);
} | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file.rs | MIT | cadcd5da5ea4649b978c247ca11f270ddf54fa04 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/cadcd5da5ea4649b978c247ca11f270ddf54fa04/tokio/tests/fs_file.rs | 201 | 213 |
tokio-rs/tokio:tokio/tests/fs_file.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(tokio_wasi)))] // Wasi does not support file operations
use std::io::prelude::*;
use tempfile::NamedTempFile;
use tokio::fs::File;
use tokio::io::{AsyncReadExt, AsyncSeekExt, AsyncWriteExt, SeekFrom};
use tokio_test::task;
const HELLO: &[u8] = b"hello world.... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file.rs | MIT | fc9518b62714daac9a38b46c698b94ac5d5b1ca2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fc9518b62714daac9a38b46c698b94ac5d5b1ca2/tokio/tests/fs_file.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/fs_file.rs:2 | let tempfile = tempfile();
let mut file = File::create(tempfile.path()).await.unwrap();
file.write_all(HELLO).await.unwrap();
file.shutdown().await.unwrap();
let file = std::fs::read(tempfile.path()).unwrap();
assert_eq!(file, HELLO);
}
#[tokio::test]
async fn rewind_seek_position() {
let te... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file.rs | MIT | fc9518b62714daac9a38b46c698b94ac5d5b1ca2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fc9518b62714daac9a38b46c698b94ac5d5b1ca2/tokio/tests/fs_file.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/fs_file.rs:3 | for _ in 0..1_000 {
if task.poll().is_pending() {
return;
}
}
panic!("did not yield");
}
fn tempfile() -> NamedTempFile {
NamedTempFile::new().unwrap()
}
#[tokio::test]
#[cfg(unix)]
async fn unix_fd() {
use std::os::unix::io::AsRawFd;
let tempfile = tempfile();
le... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file.rs | MIT | fc9518b62714daac9a38b46c698b94ac5d5b1ca2 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fc9518b62714daac9a38b46c698b94ac5d5b1ca2/tokio/tests/fs_file.rs | 81 | 112 |
tokio-rs/tokio:tokio/tests/fs_file.rs:2 | let tempfile = tempfile();
let mut file = File::create(tempfile.path()).await.unwrap();
file.write_all(HELLO).await.unwrap();
file.shutdown().await.unwrap();
let file = std::fs::read(tempfile.path()).unwrap();
assert_eq!(file, HELLO);
}
#[tokio::test]
async fn rewind_seek_position() {
let te... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file.rs | MIT | b2ada60e701d5c9e6644cf8fc42a100774f8e23f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b2ada60e701d5c9e6644cf8fc42a100774f8e23f/tokio/tests/fs_file.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/fs_file.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(all(feature = "full", not(target_os = "wasi")))] // Wasi does not support file operations
use std::io::prelude::*;
use tempfile::NamedTempFile;
use tokio::fs::File;
use tokio::io::{AsyncReadExt, AsyncSeekExt, AsyncWriteExt, SeekFrom};
use tokio_test::task;
const HELLO: &[u8] = b"hell... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file.rs | MIT | 6d3f92dddc510e9276191cfab1b0432ce8248589 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6d3f92dddc510e9276191cfab1b0432ce8248589/tokio/tests/fs_file.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/fs_file.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use std::io::prelude::*;
use tempfile::NamedTempFile;
use tokio::fs::File;
use tokio::io::{AsyncReadExt, AsyncSeekExt, AsyncWriteExt, SeekFrom};
use tokio_test::task;
const HELLO: &[u8] = b"hello world...";
#[tokio::test]
async fn basic_read() {
let mut tempfi... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file.rs | MIT | 7af0f327513d468c685776789c6fe0f68f6ed102 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7af0f327513d468c685776789c6fe0f68f6ed102/tokio/tests/fs_file.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/fs_file.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use tokio::fs::File;
use tokio::io::{AsyncReadExt, AsyncSeekExt, AsyncWriteExt};
use tokio_test::task;
use std::io::prelude::*;
use tempfile::NamedTempFile;
const HELLO: &[u8] = b"hello world...";
#[tokio::test]
async fn basic_read() {
let mut tempfile = temp... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file.rs | MIT | 3fbcf1ba5077d31ac59ede386d1ea887b4c22e99 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3fbcf1ba5077d31ac59ede386d1ea887b4c22e99/tokio/tests/fs_file.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/fs_file.rs:2 | async fn basic_write_and_shutdown() {
let tempfile = tempfile();
let mut file = File::create(tempfile.path()).await.unwrap();
file.write_all(HELLO).await.unwrap();
file.shutdown().await.unwrap();
let file = std::fs::read(tempfile.path()).unwrap();
assert_eq!(file, HELLO);
}
#[tokio::test]
as... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file.rs | MIT | 3fbcf1ba5077d31ac59ede386d1ea887b4c22e99 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3fbcf1ba5077d31ac59ede386d1ea887b4c22e99/tokio/tests/fs_file.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/fs_file.rs:3 | #[tokio::test]
#[cfg(unix)]
async fn unix_fd() {
use std::os::unix::io::AsRawFd;
let tempfile = tempfile();
let file = File::create(tempfile.path()).await.unwrap();
assert!(file.as_raw_fd() as u64 > 0);
}
#[tokio::test]
#[cfg(windows)]
async fn windows_handle() {
use std::os::windows::io::AsRawHan... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file.rs | MIT | 3fbcf1ba5077d31ac59ede386d1ea887b4c22e99 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3fbcf1ba5077d31ac59ede386d1ea887b4c22e99/tokio/tests/fs_file.rs | 81 | 100 |
tokio-rs/tokio:tokio/tests/fs_file.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use tokio::fs::File;
use tokio::io::{AsyncReadExt, AsyncSeekExt, AsyncWriteExt};
use tokio_test::task;
use std::io::prelude::*;
use tempfile::NamedTempFile;
const HELLO: &[u8] = b"hello world...";
#[tokio::test]
async fn basic_read() {
let mut tempfile = temp... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file.rs | MIT | 39706b198c6cacfb23544bad8b7c144471ee4efa | github | async-runtime | https://github.com/tokio-rs/tokio/blob/39706b198c6cacfb23544bad8b7c144471ee4efa/tokio/tests/fs_file.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/fs_file.rs:2 | let mut file = File::open(tempfile.path()).await.unwrap();
let n = file.read(&mut buf).await.unwrap();
assert_eq!(n, HELLO.len());
assert_eq!(&buf[..n], HELLO);
}
#[tokio::test]
async fn basic_write() {
let tempfile = tempfile();
let mut file = File::create(tempfile.path()).await.unwrap();
f... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file.rs | MIT | 39706b198c6cacfb23544bad8b7c144471ee4efa | github | async-runtime | https://github.com/tokio-rs/tokio/blob/39706b198c6cacfb23544bad8b7c144471ee4efa/tokio/tests/fs_file.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/fs_file.rs:3 | let mut buf = [0; 1024];
loop {
file.read(&mut buf).await.unwrap();
file.seek(std::io::SeekFrom::Start(0)).await.unwrap();
}
});
for _ in 0..1_000 {
if task.poll().is_pending() {
return;
}
}
panic!("did not yield");
}
fn tempfile() ... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file.rs | MIT | 39706b198c6cacfb23544bad8b7c144471ee4efa | github | async-runtime | https://github.com/tokio-rs/tokio/blob/39706b198c6cacfb23544bad8b7c144471ee4efa/tokio/tests/fs_file.rs | 81 | 121 |
tokio-rs/tokio:tokio/tests/fs_file.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use tokio::fs::File;
use tokio::prelude::*;
use tokio_test::task;
use std::io::prelude::*;
use tempfile::NamedTempFile;
const HELLO: &[u8] = b"hello world...";
#[tokio::test]
async fn basic_read() {
let mut tempfile = tempfile();
tempfile.write_all(HELLO)... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file.rs | MIT | 16e272ea4bcfbdc5aa3a0e36e9a3d3a639af4473 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/16e272ea4bcfbdc5aa3a0e36e9a3d3a639af4473/tokio/tests/fs_file.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/fs_file.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use tokio::fs::File;
use tokio::prelude::*;
use tokio_test::task;
use std::io::prelude::*;
use tempfile::NamedTempFile;
const HELLO: &[u8] = b"hello world...";
#[tokio::test]
async fn basic_read() {
let mut tempfile = tempfile();
tempfile.write_all(HELLO)... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file.rs | MIT | 8020b02bd0aa02e5fb887430fbb986a1376a7a9e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8020b02bd0aa02e5fb887430fbb986a1376a7a9e/tokio/tests/fs_file.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/fs_file.rs:2 | async fn coop() {
let mut tempfile = tempfile();
tempfile.write_all(HELLO).unwrap();
let mut task = task::spawn(async {
let mut file = File::open(tempfile.path()).await.unwrap();
let mut buf = [0; 1024];
loop {
file.read(&mut buf).await.unwrap();
file.seek(... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file.rs | MIT | 8020b02bd0aa02e5fb887430fbb986a1376a7a9e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8020b02bd0aa02e5fb887430fbb986a1376a7a9e/tokio/tests/fs_file.rs | 41 | 87 |
tokio-rs/tokio:tokio/tests/fs_file.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use tokio::fs::File;
use tokio::prelude::*;
use std::io::prelude::*;
use tempfile::NamedTempFile;
const HELLO: &[u8] = b"hello world...";
#[tokio::test]
async fn basic_read() {
let mut tempfile = tempfile();
tempfile.write_all(HELLO).unwrap();
let mu... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file.rs | MIT | 8a2160a913f4901fd4c81d11b0d10237837738de | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8a2160a913f4901fd4c81d11b0d10237837738de/tokio/tests/fs_file.rs | 1 | 60 |
tokio-rs/tokio:tokio/tests/fs_file.rs:2 | }
#[tokio::test]
#[cfg(unix)]
async fn unix_fd() {
use std::os::unix::io::AsRawFd;
let tempfile = tempfile();
let file = File::create(tempfile.path()).await.unwrap();
assert!(file.as_raw_fd() as u64 > 0);
}
#[tokio::test]
#[cfg(windows)]
async fn windows_handle() {
use std::os::windows::io::AsRaw... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file.rs | MIT | 8a2160a913f4901fd4c81d11b0d10237837738de | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8a2160a913f4901fd4c81d11b0d10237837738de/tokio/tests/fs_file.rs | 41 | 61 |
tokio-rs/tokio:tokio/tests/fs_file.rs:1 | #![warn(rust_2018_idioms)]
#![cfg(feature = "full")]
use tokio::fs::File;
use tokio::prelude::*;
use std::io::prelude::*;
use tempfile::NamedTempFile;
const HELLO: &[u8] = b"hello world...";
#[tokio::test]
async fn basic_read() {
let mut tempfile = tempfile();
tempfile.write_all(HELLO).unwrap();
let mu... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file.rs | MIT | 7b4c999341809588a427a9a80d310ee4aa1c1a21 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7b4c999341809588a427a9a80d310ee4aa1c1a21/tokio/tests/fs_file.rs | 1 | 41 |
tokio-rs/tokio:tokio/tests/fs_file.rs:1 | #![warn(rust_2018_idioms)]
use tokio::fs::File;
use tokio::prelude::*;
use std::io::prelude::*;
use tempfile::NamedTempFile;
const HELLO: &[u8] = b"hello world...";
#[tokio::test]
async fn basic_read() {
let mut tempfile = tempfile();
tempfile.write_all(HELLO).unwrap();
let mut file = File::open(tempfi... | rust | rust | testsuite | tokio-rs/tokio | tokio/tests/fs_file.rs | MIT | 978013a215ebae63cd087139514de32bbd36ce11 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/978013a215ebae63cd087139514de32bbd36ce11/tokio/tests/fs_file.rs | 1 | 40 |
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 | 78f2340d259487d4470681f97cc4b5eac719e178 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/78f2340d259487d4470681f97cc4b5eac719e178/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 | 78f2340d259487d4470681f97cc4b5eac719e178 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/78f2340d259487d4470681f97cc4b5eac719e178/tokio/tests/fs_file_mocked.rs | 41 | 100 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:3 | let mut t = task::spawn(file.read(&mut buf));
assert_eq!(0, pool::len());
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_e... | 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 | 81 | 140 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:4 | #[test]
fn read_with_smaller_buf() {
let (mock, file) = sys::File::mock();
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... | 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 | 121 | 180 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:5 | {
let mut buf = [0; 4];
let mut t = task::spawn(file.read(&mut buf));
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);
a... | 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 | 161 | 220 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:6 | {
let mut buf = [0; 32];
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());
... | 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 | 201 | 260 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:7 | pool::run_one();
assert_eq!(0, mock.remaining());
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()... | 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 | 241 | 300 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:8 | let mut file = File::from_std(file);
let mut actual = vec![0; chunk_d];
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.... | 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 | 281 | 340 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:9 | .write(&data[chunk_b..chunk_c])
.write(&data[chunk_c..]);
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());
... | 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 | 321 | 380 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:10 | let mut t = task::spawn(file.write(FOO));
assert_pending!(t.poll());
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();
... | 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 | 361 | 420 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:11 | pool::run_one();
let mut t = task::spawn(file.flush());
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]... | 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 | 401 | 460 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:12 | 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 t = task::spawn(file.flush());
assert_ready_ok!(t.poll());
let mut t = task::spawn(file.write(FOO));
assert_ready_ok!(t.poll(... | 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 | 441 | 500 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:13 | 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();
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 | 78f2340d259487d4470681f97cc4b5eac719e178 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/78f2340d259487d4470681f97cc4b5eac719e178/tokio/tests/fs_file_mocked.rs | 481 | 540 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:14 | 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.read(&mut buf));
assert_pending!(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 | 521 | 580 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:15 | 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.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());
... | 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 | 561 | 620 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:16 | let mut t = task::spawn(file.seek(SeekFrom::Start(0)));
assert_pending!(t.poll());
}
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();
... | 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 | 601 | 660 |
tokio-rs/tokio:tokio/tests/fs_file_mocked.rs:17 | 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 | 78f2340d259487d4470681f97cc4b5eac719e178 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/78f2340d259487d4470681f97cc4b5eac719e178/tokio/tests/fs_file_mocked.rs | 641 | 700 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.