mirror of
https://github.com/LibreQoE/LibreQoS.git
synced 2025-02-25 18:55:32 -06:00
Add a couple of unit test.
This commit is contained in:
parent
eb9b32ef65
commit
c9a443f77b
@ -220,3 +220,23 @@ pub enum EtcLqosError {
|
||||
#[error("Unable to write to /etc/lqos.conf")]
|
||||
WriteFail,
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
const EXAMPLE_LQOS_CONF: &str = include_str!("../../../lqos.example");
|
||||
|
||||
#[test]
|
||||
fn round_trip_toml() {
|
||||
let doc = EXAMPLE_LQOS_CONF.parse::<toml_edit::Document>().unwrap();
|
||||
let reserialized = doc.to_string();
|
||||
assert_eq!(EXAMPLE_LQOS_CONF, reserialized);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn add_node_id() {
|
||||
let mut doc = EXAMPLE_LQOS_CONF.parse::<toml_edit::Document>().unwrap();
|
||||
doc["node_id"] = toml_edit::value("test");
|
||||
let reserialized = doc.to_string();
|
||||
assert!(reserialized.contains("node_id = \"test\""));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user