From 59bd6e2eea151f097a65f2634dc5488b3c272d92 Mon Sep 17 00:00:00 2001 From: Daiki Ihara Date: Tue, 1 Dec 2020 00:10:12 +0900 Subject: Extract tests module to file in vfs crate --- crates/vfs/src/vfs_path/tests.rs | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 crates/vfs/src/vfs_path/tests.rs (limited to 'crates/vfs/src/vfs_path') diff --git a/crates/vfs/src/vfs_path/tests.rs b/crates/vfs/src/vfs_path/tests.rs new file mode 100644 index 000000000..510e021e8 --- /dev/null +++ b/crates/vfs/src/vfs_path/tests.rs @@ -0,0 +1,30 @@ +use super::*; + +#[test] +fn virtual_path_extensions() { + assert_eq!(VirtualPath("/".to_string()).name_and_extension(), None); + assert_eq!( + VirtualPath("/directory".to_string()).name_and_extension(), + Some(("directory", None)) + ); + assert_eq!( + VirtualPath("/directory/".to_string()).name_and_extension(), + Some(("directory", None)) + ); + assert_eq!( + VirtualPath("/directory/file".to_string()).name_and_extension(), + Some(("file", None)) + ); + assert_eq!( + VirtualPath("/directory/.file".to_string()).name_and_extension(), + Some((".file", None)) + ); + assert_eq!( + VirtualPath("/directory/.file.rs".to_string()).name_and_extension(), + Some((".file", Some("rs"))) + ); + assert_eq!( + VirtualPath("/directory/file.rs".to_string()).name_and_extension(), + Some(("file", Some("rs"))) + ); +} -- cgit v1.2.3