Skip to content

Commit

Permalink
Merge pull request #15 from tokio-rs/master
Browse files Browse the repository at this point in the history
Add foo.txt and bar.txt to .gitignore (tokio-rs#2294)
  • Loading branch information
sthagen committed Mar 7, 2020
2 parents 7b0cca8 + bc8dcde commit b99a9ba
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions tokio/tests/fs_copy.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
#![warn(rust_2018_idioms)]
#![cfg(feature = "full")]

use tempfile::tempdir;
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 dir = tempdir().unwrap();

let from = fs::read("foo.txt").await.unwrap();
let to = fs::read("bar.txt").await.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();
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);
}

0 comments on commit b99a9ba

Please sign in to comment.