diff options
-rw-r--r-- | .travis.yml | 2 | ||||
-rw-r--r-- | src/cell.rs | 12 | ||||
-rw-r--r-- | src/format.rs | 2 |
3 files changed, 14 insertions, 2 deletions
diff --git a/.travis.yml b/.travis.yml index 7137dc0..640ceec 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,4 +11,4 @@ after_success: | wget https://github.com/SimonKagstrom/kcov/archive/master.tar.gz &&
tar xzf master.tar.gz && mkdir kcov-master/build && cd kcov-master/build && cmake .. && make &&
sudo make install && cd ../.. &&
- kcov --coveralls-id=$TRAVIS_JOB_ID --exclude-pattern=/.cargo --include-pattern=/lib/*.rs target/kcov target/debug/prettytable-*
\ No newline at end of file + kcov --coveralls-id=$TRAVIS_JOB_ID --exclude-pattern=/.cargo target/kcov target/debug/prettytable-*
\ No newline at end of file diff --git a/src/cell.rs b/src/cell.rs index 31006ff..1ee2f8b 100644 --- a/src/cell.rs +++ b/src/cell.rs @@ -258,6 +258,7 @@ mod tests { use cell::Cell;
use utils::StringWriter;
use format::Align;
+ use term::{Attr, color};
#[test]
fn ascii() {
@@ -302,5 +303,16 @@ mod tests { let _ = cell.print(&mut out, 0, 10);
assert_eq!(out.as_string(), " test ");
}
+
+ #[test]
+ fn style_spec() {
+ let cell = Cell::new("test").style_spec("FrBBbuic");
+ assert!(cell.style.contains(&Attr::Underline(true)));
+ assert!(cell.style.contains(&Attr::Italic(true)));
+ assert!(cell.style.contains(&Attr::Bold));
+ assert!(cell.style.contains(&Attr::ForegroundColor(color::RED)));
+ assert!(cell.style.contains(&Attr::BackgroundColor(color::BRIGHT_BLUE)));
+ assert_eq!(cell.align, Align::CENTER);
+ }
}
diff --git a/src/format.rs b/src/format.rs index fe79b38..e01fe5b 100644 --- a/src/format.rs +++ b/src/format.rs @@ -5,7 +5,7 @@ use std::io::{Write, Error}; use super::utils::NEWLINE;
/// Alignment for cell's content
-#[derive(Clone, Debug)]
+#[derive(Clone, Debug, PartialEq)]
pub enum Align {
LEFT,
CENTER,
|