1#![warn(rust_2018_idioms)]
2#![cfg(all(feature = "full", not(target_os = "wasi")))] // WASI does not support all fs operations
3#![cfg(windows)]
4
5use tempfile::tempdir;
6use tokio::fs;
7
8#[tokio::test]
9async fn symlink_file_windows() {
10 let dir = tempdir().unwrap();
11
12 let source_path = dir.path().join("foo.txt");
13 let dest_path = dir.path().join("bar.txt");
14
15 fs::write(&source_path, b"Hello File!").await.unwrap();
16 fs::symlink_file(&source_path, &dest_path).await.unwrap();
17
18 fs::write(&source_path, b"new data!").await.unwrap();
19
20 let from = fs::read(&source_path).await.unwrap();
21 let to = fs::read(&dest_path).await.unwrap();
22
23 assert_eq!(from, to);
24}
25