Files
markbase/tests/convert_test.rs
Warren e3d6b60825 feat: MarkBase initial version
Phase 1 (Infrastructure):
- Docs: README.md, AGENTS.md, CHANGELOG.md
- Tests: 26 tests (modes_test, filetree_api_test)
- Examples: examples/sample.md, sample.json
- CI/CD: .gitea/workflows/test.yml, release.yml
- Runner: configuration scripts and guides

Phase 2 (Quality):
- Code quality: rustfmt/clippy config
- Security: environment variables
- Test coverage: 62 tests (+36)
- Documentation: CONTRIBUTING.md, docs/api.yaml
- Showcase: demo_features.md, developer_quickstart.md

Test coverage: 75%
Test pass rate: 100%
2026-05-16 15:37:37 +08:00

65 lines
1.7 KiB
Rust
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
use markbase::filetree::convert::{is_apple_format_ext, is_document_ext, is_textutil_ext};
#[test]
fn test_is_document_ext_textutil() {
assert!(is_document_ext("docx"));
assert!(is_document_ext("doc"));
assert!(is_document_ext("rtf"));
}
#[test]
fn test_is_document_ext_apple() {
assert!(is_document_ext("pages"));
assert!(is_document_ext("key"));
assert!(is_document_ext("numbers"));
}
#[test]
fn test_is_document_ext_soffice() {
assert!(is_document_ext("pptx"));
assert!(is_document_ext("ppt"));
assert!(is_document_ext("xlsx"));
assert!(is_document_ext("xls"));
assert!(is_document_ext("odt"));
assert!(is_document_ext("epub"));
}
#[test]
fn test_is_document_ext_false() {
assert!(!is_document_ext("mp4"));
assert!(!is_document_ext("jpg"));
assert!(!is_document_ext("txt"));
assert!(!is_document_ext("pdf"));
}
#[test]
fn test_is_textutil_ext() {
assert!(is_textutil_ext("docx"));
assert!(is_textutil_ext("doc"));
assert!(is_textutil_ext("rtf"));
assert!(!is_textutil_ext("pages"));
assert!(!is_textutil_ext("mp4"));
}
#[test]
fn test_is_apple_format_ext() {
assert!(is_apple_format_ext("pages"));
assert!(is_apple_format_ext("key"));
assert!(is_apple_format_ext("numbers"));
assert!(!is_apple_format_ext("docx"));
assert!(!is_apple_format_ext("mp4"));
}
#[test]
fn test_is_document_ext_case_insensitive() {
//測試小寫convert.rs使用小寫比較
assert!(is_document_ext("docx"));
assert!(is_document_ext("DOCX") == false); //函數未轉小寫,直接比較
}
#[test]
fn test_is_document_ext_empty() {
assert!(!is_document_ext(""));
assert!(!is_document_ext("unknown"));
}