summaryrefslogtreecommitdiff
path: root/cli/util/path.rs
diff options
context:
space:
mode:
authorhaturau <135221985+haturatu@users.noreply.github.com>2024-11-20 01:20:47 +0900
committerGitHub <noreply@github.com>2024-11-20 01:20:47 +0900
commit85719a67e59c7aa45bead26e4942d7df8b1b42d4 (patch)
treeface0aecaac53e93ce2f23b53c48859bcf1a36ec /cli/util/path.rs
parent67697bc2e4a62a9670699fd18ad0dd8efc5bd955 (diff)
parent186b52731c6bb326c4d32905c5e732d082e83465 (diff)
Merge branch 'denoland:main' into main
Diffstat (limited to 'cli/util/path.rs')
-rw-r--r--cli/util/path.rs27
1 files changed, 0 insertions, 27 deletions
diff --git a/cli/util/path.rs b/cli/util/path.rs
index e4ae6e7cb..58bed664f 100644
--- a/cli/util/path.rs
+++ b/cli/util/path.rs
@@ -42,21 +42,6 @@ pub fn get_extension(file_path: &Path) -> Option<String> {
.map(|e| e.to_lowercase());
}
-pub fn specifier_has_extension(
- specifier: &ModuleSpecifier,
- searching_ext: &str,
-) -> bool {
- let Some((_, ext)) = specifier.path().rsplit_once('.') else {
- return false;
- };
- let searching_ext = searching_ext.strip_prefix('.').unwrap_or(searching_ext);
- debug_assert!(!searching_ext.contains('.')); // exts like .d.ts are not implemented here
- if ext.len() != searching_ext.len() {
- return false;
- }
- ext.eq_ignore_ascii_case(searching_ext)
-}
-
pub fn get_atomic_dir_path(file_path: &Path) -> PathBuf {
let rand = gen_rand_path_component();
let new_file_name = format!(
@@ -351,18 +336,6 @@ mod test {
}
#[test]
- fn test_specifier_has_extension() {
- fn get(specifier: &str, ext: &str) -> bool {
- specifier_has_extension(&ModuleSpecifier::parse(specifier).unwrap(), ext)
- }
-
- assert!(get("file:///a/b/c.ts", "ts"));
- assert!(get("file:///a/b/c.ts", ".ts"));
- assert!(!get("file:///a/b/c.ts", ".cts"));
- assert!(get("file:///a/b/c.CtS", ".cts"));
- }
-
- #[test]
fn test_to_percent_decoded_str() {
let str = to_percent_decoded_str("%F0%9F%A6%95");
assert_eq!(str, "🦕");