summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre-Henri Symoneaux <pierre-henri.symoneaux@nokia.com>2017-06-06 13:16:06 +0200
committerPierre-Henri Symoneaux <pierre-henri.symoneaux@nokia.com>2017-06-06 13:16:06 +0200
commit38aaa2d7dd1d8e641d5ddefcfc2283d95ed68306 (patch)
tree250fcf93f44a3e8beaf7f8c83bc82a612dd23986
parentf0302ad1af7c1c0b0a0c3f550602bbd71f39e6bc (diff)
Increase coverage
-rw-r--r--src/cell.rs18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/cell.rs b/src/cell.rs
index fd0e0f0..16ab37e 100644
--- a/src/cell.rs
+++ b/src/cell.rs
@@ -359,13 +359,27 @@ mod tests {
assert!(cell.style
.contains(&Attr::ForegroundColor(color::BRIGHT_BLACK)));
assert!(cell.style.contains(&Attr::BackgroundColor(color::WHITE)));
- assert_eq!(cell.align, Alignment::RIGHT)
+ assert_eq!(cell.align, Alignment::RIGHT);
+
+ // Test with invalid sepcifier chars
+ cell = cell.clone();
+ cell = cell.style_spec("FzBr");
+ assert!(cell.style.contains(&Attr::BackgroundColor(color::RED)));
+ assert_eq!(cell.style.len(), 1);
+ cell = cell.style_spec("zzz");
+ assert!(cell.style.is_empty());
}
#[test]
fn reset_style() {
- let mut cell = Cell::new("test").style_spec("FDBwr");
+ let mut cell = Cell::new("test")
+ .with_style(Attr::ForegroundColor(color::BRIGHT_BLACK))
+ .with_style(Attr::BackgroundColor(color::WHITE));
+ cell.align(Alignment::RIGHT);
+
+ //style_spec("FDBwr");
assert_eq!(cell.style.len(), 2);
+ assert_eq!(cell.align, Alignment::RIGHT);
cell.reset_style();
assert_eq!(cell.style.len(), 0);
assert_eq!(cell.align, Alignment::LEFT);