summaryrefslogtreecommitdiff
path: root/cli/fs_util.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/fs_util.rs')
-rw-r--r--cli/fs_util.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/cli/fs_util.rs b/cli/fs_util.rs
index 2f10a523f..9d60dad28 100644
--- a/cli/fs_util.rs
+++ b/cli/fs_util.rs
@@ -152,6 +152,19 @@ pub fn is_supported_test_path(path: &Path) -> bool {
}
}
+/// Checks if the path has a basename and extension Deno supports for benches.
+pub fn is_supported_bench_path(path: &Path) -> bool {
+ if let Some(name) = path.file_stem() {
+ let basename = name.to_string_lossy();
+ (basename.ends_with("_bench")
+ || basename.ends_with(".bench")
+ || basename == "bench")
+ && is_supported_ext(path)
+ } else {
+ false
+ }
+}
+
/// Checks if the path has an extension Deno supports for tests.
pub fn is_supported_test_ext(path: &Path) -> bool {
if let Some(ext) = get_extension(path) {