use super::{ExecutionLevel, SupportedOS}; use crate::{empty_manifest, new_manifest}; fn enc(s: &str) -> String { let mut buf = String::with_capacity(1024); buf.push('\u{feff}'); for l in s.lines() { buf.push_str(l); buf.push_str("\r\n"); } buf.truncate(buf.len() - 2); buf } fn encp(s: &str) -> String { s.replace("\n", "\r\n") } #[test] fn empty_manifest_canonical() { let builder = empty_manifest(); assert_eq!( format!("{}", builder), enc(r#" "#) ); } #[test] fn empty_manifest_pretty() { let builder = empty_manifest(); assert_eq!( format!("{:#}", builder), encp( r#" "# ) ); } #[test] fn only_execution_level() { let builder = empty_manifest().requested_execution_level(ExecutionLevel::AsInvoker); assert_eq!( format!("{:#}", builder), encp( r#" "# ) ); } #[test] fn only_windows10() { let builder = empty_manifest().supported_os(SupportedOS::Windows10..); assert_eq!( format!("{:#}", builder), encp( r#" "# ) ); } #[test] fn no_comctl32_6() { let builder = new_manifest("Company.OrgUnit.Program") .version(1, 0, 0, 2) .remove_dependency("Microsoft.Windows.Common-Controls"); assert_eq!( format!("{:#}", builder), encp( r#" UTF-8 permonitorv2 true true "# ) ); }