mirror of
https://github.com/lsd-rs/lsd
synced 2024-12-14 06:02:36 +00:00
add test for short size render
This commit is contained in:
parent
20a6a09695
commit
bef4ad22a6
1 changed files with 12 additions and 0 deletions
|
@ -141,6 +141,7 @@ impl Size {
|
|||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::Size;
|
||||
use crate::color::{Colors, Theme};
|
||||
use crate::flags::{Flags, SizeFlag};
|
||||
|
||||
#[test]
|
||||
|
@ -218,4 +219,15 @@ mod test {
|
|||
assert_eq!(size.value_string(&flags).as_str(), "42");
|
||||
assert_eq!(size.unit_string(&flags).as_str(), "KB");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn render_short_nospaces() {
|
||||
let size = Size::new(42 * 1024); // 42 kilobytes
|
||||
let mut flags = Flags::default();
|
||||
flags.size = SizeFlag::Short;
|
||||
let colors = Colors::new(Theme::NoColor);
|
||||
|
||||
assert_eq!(size.render(&colors, &flags, 2).to_string(), "42K");
|
||||
assert_eq!(size.render(&colors, &flags, 3).to_string(), " 42K");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue