added test for layout of table in tui
This commit is contained in:
parent
ffe175df1b
commit
08dbfd827b
@ -75,7 +75,7 @@ where
|
||||
Value::F32(f) => output += &format!("{}{}\n", pad, f),
|
||||
Value::F64(f) => output += &format!("{}{}\n", pad, f),
|
||||
Value::Char(c) => output += &format!("{}{}\n", pad, c),
|
||||
Value::String(s) => output += &format!("{}{}\n", pad, s),
|
||||
Value::String(s) => output += &format!("{}{:<26}\n", pad, s),
|
||||
Value::Unit => output += &format!("{}<unit>\n", pad),
|
||||
Value::Bytes(bytes) => output += &format!("{}{:?}\n", pad, bytes),
|
||||
|
||||
@ -146,3 +146,21 @@ where
|
||||
output
|
||||
}
|
||||
}
|
||||
|
||||
//TODO write test to check that the output is what it should be
|
||||
//
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use crate::modules::dns::DnsScore;
|
||||
use crate::topology::{self, HAClusterTopology};
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_format_values_as_string() {
|
||||
|
||||
let dns_score = Box::new(DnsScore::new(vec![], None));
|
||||
let print_score_output = <DnsScore as ScoreToString<HAClusterTopology>>::print_score_details(&dns_score);
|
||||
let expected_empty_dns_score_table = "\n+--------------------------+----------------------------+\n| score_name | DnsScore |\n+--------------------------+----------------------------+\n| dns_entries | [] |\n| register_dhcp_leases | None |\n+--------------------------+----------------------------+\n\n\n";
|
||||
assert_eq!(print_score_output, expected_empty_dns_score_table);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user