1 #![warn(rust_2018_idioms)] 2 #![cfg(all(feature = "full", not(target_os = "wasi")))] // WASI does not support all fs operations 3 4 use tokio::fs; 5 6 #[tokio::test] 7 #[cfg(unix)] canonicalize_root_dir_unix()8async fn canonicalize_root_dir_unix() { 9 assert_eq!(fs::canonicalize("/.").await.unwrap().to_str().unwrap(), "/"); 10 } 11 12 #[tokio::test] 13 #[cfg(windows)] canonicalize_root_dir_windows()14async fn canonicalize_root_dir_windows() { 15 // 2-step let bindings due to Rust memory semantics 16 let dir_path = fs::canonicalize("C:\\.\\").await.unwrap(); 17 18 let dir_name = dir_path.to_str().unwrap(); 19 20 assert!(dir_name.starts_with("\\\\")); 21 assert!(dir_name.ends_with("C:\\")); 22 } 23