use selinux_configfile::{ConfigFile, SelinuxMode};
fn main() {
let input = "\
# SELinux configuration
SELINUX = enforcing
SELINUXTYPE = targeted
";
let mut cfg = ConfigFile::parse(input).expect("valid config");
println!("Current mode: {:?}", cfg.selinux());
println!("Current type: {:?}", cfg.selinuxtype());
cfg.set_selinux(SelinuxMode::Permissive);
cfg.set_selinuxtype("mls").expect("valid policy type");
let output = cfg.to_string();
println!("Modified config:\n{}", output);
assert!(output.contains("# SELinux configuration"));
assert!(output.contains("SELINUX = permissive"));
assert!(output.contains("SELINUXTYPE = mls"));
}