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%
65 lines
1.7 KiB
Rust
65 lines
1.7 KiB
Rust
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"));
|
||
}
|