| @@ -858,8 +858,9 @@ pub fn compare_paths( · 857 unmodified lines |
| 858 | #[cfg(test)] | 858 | #[cfg(test)] |
| 859 | mod tests { | 859 | mod tests { |
| 860 | use super::*; | 860 | use super::*; |
| | 861 | use util_macros::perf; |
| 861 | | 862 | |
| 862 | #[test] | 863 | #[perf] |
| 863 | fn compare_paths_with_dots() { | 864 | fn compare_paths_with_dots() { |
| 864 | let mut paths = vec![ | 865 | let mut paths = vec![ |
| 865 | (Path::new("test_dirs"), false), | 866 | (Path::new("test_dirs"), false), |
| @@ -897,7 +898,7 @@ mod tests { · 31 unmodified lines |
| 897 | ); | 898 | ); |
| 898 | } | 899 | } |
| 899 | | 900 | |
| 900 | #[test] | 901 | #[perf] |
| 901 | fn compare_paths_with_same_name_different_extensions() { | 902 | fn compare_paths_with_same_name_different_extensions() { |
| 902 | let mut paths = vec![ | 903 | let mut paths = vec![ |
| 903 | (Path::new("test_dirs/file.rs"), true), | 904 | (Path::new("test_dirs/file.rs"), true), |
| @@ -919,7 +920,7 @@ mod tests { · 15 unmodified lines |
| 919 | ); | 920 | ); |
| 920 | } | 921 | } |
| 921 | | 922 | |
| 922 | #[test] | 923 | #[perf] |
| 923 | fn compare_paths_case_semi_sensitive() { | 924 | fn compare_paths_case_semi_sensitive() { |
| 924 | let mut paths = vec![ | 925 | let mut paths = vec![ |
| 925 | (Path::new("test_DIRS"), false), | 926 | (Path::new("test_DIRS"), false), |
| @@ -951,7 +952,7 @@ mod tests { · 25 unmodified lines |
| 951 | ); | 952 | ); |
| 952 | } | 953 | } |
| 953 | | 954 | |
| 954 | #[test] | 955 | #[perf] |
| 955 | fn path_with_position_parse_posix_path() { | 956 | fn path_with_position_parse_posix_path() { |
| 956 | // Test POSIX filename edge cases | 957 | // Test POSIX filename edge cases |
| 957 | // Read more at https://en.wikipedia.org/wiki/Filename | 958 | // Read more at https://en.wikipedia.org/wiki/Filename |
| @@ -1038,7 +1039,7 @@ mod tests { · 80 unmodified lines |
| 1038 | ); | 1039 | ); |
| 1039 | } | 1040 | } |
| 1040 | | 1041 | |
| 1041 | #[test] | 1042 | #[perf] |
| 1042 | #[cfg(not(target_os = "windows"))] | 1043 | #[cfg(not(target_os = "windows"))] |
| 1043 | fn path_with_position_parse_posix_path_with_suffix() { | 1044 | fn path_with_position_parse_posix_path_with_suffix() { |
| 1044 | assert_eq!( | 1045 | assert_eq!( |
| @@ -1094,7 +1095,7 @@ mod tests { · 49 unmodified lines |
| 1094 | ); | 1095 | ); |
| 1095 | } | 1096 | } |
| 1096 | | 1097 | |
| 1097 | #[test] | 1098 | #[perf] |
| 1098 | #[cfg(target_os = "windows")] | 1099 | #[cfg(target_os = "windows")] |
| 1099 | fn path_with_position_parse_windows_path() { | 1100 | fn path_with_position_parse_windows_path() { |
| 1100 | assert_eq!( | 1101 | assert_eq!( |
| @@ -1116,7 +1117,7 @@ mod tests { · 15 unmodified lines |
| 1116 | ); | 1117 | ); |
| 1117 | } | 1118 | } |
| 1118 | | 1119 | |
| 1119 | #[test] | 1120 | #[perf] |
| 1120 | #[cfg(target_os = "windows")] | 1121 | #[cfg(target_os = "windows")] |
| 1121 | fn path_with_position_parse_windows_path_with_suffix() { | 1122 | fn path_with_position_parse_windows_path_with_suffix() { |
| 1122 | assert_eq!( | 1123 | assert_eq!( |
| @@ -1229,7 +1230,7 @@ mod tests { · 106 unmodified lines |
| 1229 | ); | 1230 | ); |
| 1230 | } | 1231 | } |
| 1231 | | 1232 | |
| 1232 | #[test] | 1233 | #[perf] |
| 1233 | fn test_path_compact() { | 1234 | fn test_path_compact() { |
| 1234 | let path: PathBuf = [ | 1235 | let path: PathBuf = [ |
| 1235 | home_dir().to_string_lossy().to_string(), | 1236 | home_dir().to_string_lossy().to_string(), |
| @@ -1244,7 +1245,7 @@ mod tests { · 8 unmodified lines |
| 1244 | } | 1245 | } |
| 1245 | } | 1246 | } |
| 1246 | | 1247 | |
| 1247 | #[test] | 1248 | #[perf] |
| 1248 | fn test_extension_or_hidden_file_name() { | 1249 | fn test_extension_or_hidden_file_name() { |
| 1249 | // No dots in name | 1250 | // No dots in name |
| 1250 | let path = Path::new("/a/b/c/file_name.rs"); | 1251 | let path = Path::new("/a/b/c/file_name.rs"); |
| @@ -1267,7 +1268,7 @@ mod tests { · 16 unmodified lines |
| 1267 | assert_eq!(path.extension_or_hidden_file_name(), Some("eslintrc.js")); | 1268 | assert_eq!(path.extension_or_hidden_file_name(), Some("eslintrc.js")); |
| 1268 | } | 1269 | } |
| 1269 | | 1270 | |
| 1270 | #[test] | 1271 | #[perf] |
| 1271 | fn edge_of_glob() { | 1272 | fn edge_of_glob() { |
| 1272 | let path = Path::new("/work/node_modules"); | 1273 | let path = Path::new("/work/node_modules"); |
| 1273 | let path_matcher = | 1274 | let path_matcher = |
| @@ -1278,7 +1279,7 @@ mod tests { · 4 unmodified lines |
| 1278 | ); | 1279 | ); |
| 1279 | } | 1280 | } |
| 1280 | | 1281 | |
| 1281 | #[test] | 1282 | #[perf] |
| 1282 | fn project_search() { | 1283 | fn project_search() { |
| 1283 | let path = Path::new("/Users/someonetoignore/work/zed/zed.dev/node_modules"); | 1284 | let path = Path::new("/Users/someonetoignore/work/zed/zed.dev/node_modules"); |
| 1284 | let path_matcher = | 1285 | let path_matcher = |
| @@ -1289,7 +1290,7 @@ mod tests { · 4 unmodified lines |
| 1289 | ); | 1290 | ); |
| 1290 | } | 1291 | } |
| 1291 | | 1292 | |
| 1292 | #[test] | 1293 | #[perf] |
| 1293 | #[cfg(target_os = "windows")] | 1294 | #[cfg(target_os = "windows")] |
| 1294 | fn test_sanitized_path() { | 1295 | fn test_sanitized_path() { |
| 1295 | let path = Path::new("C:\\Users\\someone\\test_file.rs"); | 1296 | let path = Path::new("C:\\Users\\someone\\test_file.rs"); |
| @@ -1307,7 +1308,7 @@ mod tests { · 11 unmodified lines |
| 1307 | ); | 1308 | ); |
| 1308 | } | 1309 | } |
| 1309 | | 1310 | |
| 1310 | #[test] | 1311 | #[perf] |
| 1311 | fn test_compare_numeric_segments() { | 1312 | fn test_compare_numeric_segments() { |
| 1312 | // Helper function to create peekable iterators and test | 1313 | // Helper function to create peekable iterators and test |
| 1313 | fn compare(a: &str, b: &str) -> Ordering { | 1314 | fn compare(a: &str, b: &str) -> Ordering { |
| @@ -1375,7 +1376,7 @@ mod tests { · 61 unmodified lines |
| 1375 | assert_eq!(b_iter.collect::<String>(), "def"); | 1376 | assert_eq!(b_iter.collect::<String>(), "def"); |
| 1376 | } | 1377 | } |
| 1377 | | 1378 | |
| 1378 | #[test] | 1379 | #[perf] |
| 1379 | fn test_natural_sort() { | 1380 | fn test_natural_sort() { |
| 1380 | // Basic alphanumeric | 1381 | // Basic alphanumeric |
| 1381 | assert_eq!(natural_sort("a", "b"), Ordering::Less); | 1382 | assert_eq!(natural_sort("a", "b"), Ordering::Less); |
| @@ -1429,7 +1430,7 @@ mod tests { · 47 unmodified lines |
| 1429 | assert_eq!(natural_sort("File_a1", "File_A1"), Ordering::Less); | 1430 | assert_eq!(natural_sort("File_a1", "File_A1"), Ordering::Less); |
| 1430 | } | 1431 | } |
| 1431 | | 1432 | |
| 1432 | #[test] | 1433 | #[perf] |
| 1433 | fn test_compare_paths() { | 1434 | fn test_compare_paths() { |
| 1434 | // Helper function for cleaner tests | 1435 | // Helper function for cleaner tests |
| 1435 | fn compare(a: &str, is_a_file: bool, b: &str, is_b_file: bool) -> Ordering { | 1436 | fn compare(a: &str, is_a_file: bool, b: &str, is_b_file: bool) -> Ordering { |
| @@ -1515,8 +1516,9 @@ mod tests { · 79 unmodified lines |
| 1515 | ); | 1516 | ); |
| 1516 | } | 1517 | } |
| 1517 | | 1518 | |
| 1518 | #[test] | 1519 | #[perf] |
| 1519 | fn test_natural_sort_case_sensitivity() { | 1520 | fn test_natural_sort_case_sensitivity() { |
| | 1521 | std::thread::sleep(std::time::Duration::from_millis(100)); |
| 1520 | // Same letter different case - lowercase should come first | 1522 | // Same letter different case - lowercase should come first |
| 1521 | assert_eq!(natural_sort("a", "A"), Ordering::Less); | 1523 | assert_eq!(natural_sort("a", "A"), Ordering::Less); |
| 1522 | assert_eq!(natural_sort("A", "a"), Ordering::Greater); | 1524 | assert_eq!(natural_sort("A", "a"), Ordering::Greater); |
| @@ -1534,7 +1536,7 @@ mod tests { · 11 unmodified lines |
| 1534 | assert_eq!(natural_sort("a", "B"), Ordering::Less); | 1536 | assert_eq!(natural_sort("a", "B"), Ordering::Less); |
| 1535 | } | 1537 | } |
| 1536 | | 1538 | |
| 1537 | #[test] | 1539 | #[perf] |
| 1538 | fn test_natural_sort_with_numbers() { | 1540 | fn test_natural_sort_with_numbers() { |
| 1539 | // Basic number ordering | 1541 | // Basic number ordering |
| 1540 | assert_eq!(natural_sort("file1", "file2"), Ordering::Less); | 1542 | assert_eq!(natural_sort("file1", "file2"), Ordering::Less); |
| @@ -1612,7 +1614,7 @@ mod tests { · 71 unmodified lines |
| 1612 | assert_eq!(natural_sort("file1", "File2"), Ordering::Less); | 1614 | assert_eq!(natural_sort("file1", "File2"), Ordering::Less); |
| 1613 | } | 1615 | } |
| 1614 | | 1616 | |
| 1615 | #[test] | 1617 | #[perf] |
| 1616 | fn test_natural_sort_edge_cases() { | 1618 | fn test_natural_sort_edge_cases() { |
| 1617 | // Empty strings | 1619 | // Empty strings |
| 1618 | assert_eq!(natural_sort("", ""), Ordering::Equal); | 1620 | assert_eq!(natural_sort("", ""), Ordering::Equal); |