Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions crates/warpui_core/src/platform/file_picker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ impl FileType {
pub fn extensions(&self) -> &[&str] {
match self {
FileType::Image => &["png", "jpg", "jpeg"],
FileType::Yaml => &["yaml"],
FileType::Markdown => &["md"],
FileType::Yaml => &["yaml", "yml"],
FileType::Markdown => &["md", "markdown"],
}
}

Expand Down Expand Up @@ -146,3 +146,18 @@ impl SaveFilePickerConfiguration {
self
}
}

#[cfg(test)]
mod tests {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per repo conventions, could you put this in a file_picker_tests.rs file alongside this one? You can then use a #[path] attribute to add that file as the test module.

use super::*;

#[test]
fn yaml_file_type_accepts_both_yaml_and_yml() {
assert_eq!(FileType::Yaml.extensions(), &["yaml", "yml"]);
}

#[test]
fn markdown_file_type_accepts_md_and_markdown() {
assert_eq!(FileType::Markdown.extensions(), &["md", "markdown"]);
}
}