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")); }