Skip to content

Commit

Permalink
🚩 Drop quick-xml feature "overlapped-lists"
Browse files Browse the repository at this point in the history
  • Loading branch information
jokeyrhyme committed Nov 15, 2024
1 parent 1db765c commit b402171
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ hex = "0.4.3"
xdg-home = "1.1.0"
rand = "0.8.5"
event-listener = "5.3.0"
quick-xml = { version = "0.36.2", features = ["overlapped-lists", "serialize"] }
quick-xml = { version = "0.36.2", features = ["serialize"] }

[target.'cfg(unix)'.dependencies]
nix = { version = "0.29.0", features = ["user"] }
Expand Down
51 changes: 51 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -686,6 +686,57 @@ mod tests {
);
}

#[test]
fn bus_config_parse_with_overlapped_lists_ok() {
// confirm this works with/without quick-xml's [`overlapped-lists`] feature
// [`overlapped-lists`]: https://docs.rs/quick-xml/latest/quick_xml/#overlapped-lists
let input = r#"<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-Bus Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<auth>ANONYMOUS</auth>
<listen>unix:path=/tmp/foo</listen>
<policy context="default">
<allow own="*"/>
<deny own="*"/>
<allow own="*"/>
</policy>
<auth>EXTERNAL</auth>
<listen>tcp:host=localhost,port=1234</listen>
<policy context="default">
<deny own="*"/>
<allow own="*"/>
<deny own="*"/>
</policy>
</busconfig>
"#;

let busconfig = BusConfig::parse(input).expect("should parse XML input");

assert_eq!(
busconfig,
BusConfig {
auth: HashSet::from_iter([String::from("ANONYMOUS"), String::from("EXTERNAL")]),
listen: HashSet::from_iter(vec![
String::from("unix:path=/tmp/foo"),
String::from("tcp:host=localhost,port=1234"),
]),
policies: vec![
Policy::DefaultContext(vec![
(Access::Allow, Operation::Own),
(Access::Deny, Operation::Own),
(Access::Allow, Operation::Own),
]),
Policy::DefaultContext(vec![
(Access::Deny, Operation::Own),
(Access::Allow, Operation::Own),
(Access::Deny, Operation::Own),
]),
],
..Default::default()
}
);
}

#[test]
fn bus_config_parse_with_pidfile_ok() {
let input = r#"<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-Bus Bus Configuration 1.0//EN"
Expand Down

0 comments on commit b402171

Please sign in to comment.