mirror of
https://github.com/tokio-rs/tokio.git
synced 2025-10-01 12:20:39 +00:00
Add foo.txt and bar.txt to .gitignore (#2294)
This commit is contained in:
parent
a78b1c65cc
commit
bc8dcdeb58
@ -1,15 +1,21 @@
|
|||||||
#![warn(rust_2018_idioms)]
|
#![warn(rust_2018_idioms)]
|
||||||
#![cfg(feature = "full")]
|
#![cfg(feature = "full")]
|
||||||
|
|
||||||
|
use tempfile::tempdir;
|
||||||
use tokio::fs;
|
use tokio::fs;
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn copy() {
|
async fn copy() {
|
||||||
fs::write("foo.txt", b"Hello File!").await.unwrap();
|
let dir = tempdir().unwrap();
|
||||||
fs::copy("foo.txt", "bar.txt").await.unwrap();
|
|
||||||
|
|
||||||
let from = fs::read("foo.txt").await.unwrap();
|
let source_path = dir.path().join("foo.txt");
|
||||||
let to = fs::read("bar.txt").await.unwrap();
|
let dest_path = dir.path().join("bar.txt");
|
||||||
|
|
||||||
|
fs::write(&source_path, b"Hello File!").await.unwrap();
|
||||||
|
fs::copy(&source_path, &dest_path).await.unwrap();
|
||||||
|
|
||||||
|
let from = fs::read(&source_path).await.unwrap();
|
||||||
|
let to = fs::read(&dest_path).await.unwrap();
|
||||||
|
|
||||||
assert_eq!(from, to);
|
assert_eq!(from, to);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user