use super::*; use indexmap::{indexmap, indexset}; /// Test assembling a complete file. #[test] fn app01() -> Result<()> { let expected = "\ \n\ \ Microsoft Excel\ 0\ false\ \ \ \ Worksheets\ \ \ 1\ \ \ \ \ \ Sheet1\ \ \ \ false\ false\ false\ 12.0000\ \ "; let part_names = indexset! { "Sheet1".to_string(), }; let heading_pairs = indexmap! { "Worksheets".to_string() => "1".to_string(), }; let properties = DocProperties::default(); let app = App { part_names, heading_pairs, properties: &properties, }; assert_eq!(app.write_xml_document_to_string()?.as_str(), expected); Ok(()) } /// Test assembling a complete file. #[test] fn app02() -> Result<()> { let expected = "\ \n\ \ Microsoft Excel\ 0\ false\ \ \ \ Worksheets\ \ \ 2\ \ \ \ \ \ Sheet1\ Sheet2\ \ \ \ false\ false\ false\ 12.0000\ \ "; let part_names = indexset! { "Sheet1".to_string(), "Sheet2".to_string(), }; let heading_pairs = indexmap! { "Worksheets".to_string() => "2".to_string(), }; let properties = DocProperties::default(); let app = App { part_names, heading_pairs, properties: &properties, }; assert_eq!(app.write_xml_document_to_string()?.as_str(), expected); Ok(()) } /// Test assembling a complete file. #[test] fn app03() -> Result<()> { let expected = "\ \n\ \ Microsoft Excel\ 0\ false\ \ \ \ Worksheets\ \ \ 1\ \ \ Named Ranges\ \ \ 1\ \ \ \ \ \ Sheet1\ Sheet1!Print_Titles\ \ \ \ false\ false\ false\ 12.0000\ \ "; let part_names = indexset! { "Sheet1".to_string(), "Sheet1!Print_Titles".to_string(), }; let heading_pairs = indexmap! { "Worksheets".to_string() => "1".to_string(), "Named Ranges".to_string() => "1".to_string(), }; let properties = DocProperties::default(); let app = App { part_names, heading_pairs, properties: &properties, }; assert_eq!(app.write_xml_document_to_string()?.as_str(), expected); Ok(()) }