#[cfg(test)] mod tests { use tempfile::tempdir; use std::fs::File; use std::io::Write; #[test] fn test_save_mode_basic_functionality() { // Create a temporary directory for testing let dir = tempdir().expect("Failed to create temporary directory"); let file_path = dir.path().join("test_input.txt"); // Create a test file { let mut file = File::create(&file_path).expect("Failed to create test file"); writeln!(file, "test content for save mode").expect("Failed to write to test file"); } // Verify file was created assert!(file_path.exists()); // Note: Actual save mode testing would require integration with the keep database // and compression engines, which is complex for unit tests } #[test] fn test_save_mode_empty_file() { // Create a temporary directory for testing let dir = tempdir().expect("Failed to create temporary directory"); let file_path = dir.path().join("empty_test.txt"); // Create an empty test file { let _file = File::create(&file_path).expect("Failed to create empty test file"); // File is automatically closed when it goes out of scope } // Verify empty file was created assert!(file_path.exists()); let metadata = std::fs::metadata(&file_path).expect("Failed to get file metadata"); assert_eq!(metadata.len(), 0); } }