aboutsummaryrefslogtreecommitdiff
path: root/crates/vfs/src/vfs_path
diff options
context:
space:
mode:
Diffstat (limited to 'crates/vfs/src/vfs_path')
-rw-r--r--crates/vfs/src/vfs_path/tests.rs30
1 files changed, 30 insertions, 0 deletions
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 @@
1use super::*;
2
3#[test]
4fn virtual_path_extensions() {
5 assert_eq!(VirtualPath("/".to_string()).name_and_extension(), None);
6 assert_eq!(
7 VirtualPath("/directory".to_string()).name_and_extension(),
8 Some(("directory", None))
9 );
10 assert_eq!(
11 VirtualPath("/directory/".to_string()).name_and_extension(),
12 Some(("directory", None))
13 );
14 assert_eq!(
15 VirtualPath("/directory/file".to_string()).name_and_extension(),
16 Some(("file", None))
17 );
18 assert_eq!(
19 VirtualPath("/directory/.file".to_string()).name_and_extension(),
20 Some((".file", None))
21 );
22 assert_eq!(
23 VirtualPath("/directory/.file.rs".to_string()).name_and_extension(),
24 Some((".file", Some("rs")))
25 );
26 assert_eq!(
27 VirtualPath("/directory/file.rs".to_string()).name_and_extension(),
28 Some(("file", Some("rs")))
29 );
30}