aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2016-04-28 00:36:17 -0400
committerJesse Luehrs <doy@tozt.net>2016-04-28 00:36:17 -0400
commite1b809a33883de11b8201eb46689794539028655 (patch)
treede312684b7cac8a40a8d1de37173b9433456851e
parente9879824b01d3c97c7be6aa61c9e429446d4a3f3 (diff)
downloadvt100-rust-e1b809a33883de11b8201eb46689794539028655.tar.gz
vt100-rust-e1b809a33883de11b8201eb46689794539028655.zip
the tests module is unnecessary here
-rw-r--r--tests/basic.rs131
1 files changed, 63 insertions, 68 deletions
diff --git a/tests/basic.rs b/tests/basic.rs
index f6cbad0..babec39 100644
--- a/tests/basic.rs
+++ b/tests/basic.rs
@@ -1,79 +1,74 @@
extern crate vt100;
-#[cfg(test)]
-mod tests {
- use vt100;
-
- #[test]
- fn object_creation() {
- let screen = vt100::Screen::new(24, 80);
- assert_eq!(screen.rows(), 24);
- assert_eq!(screen.cols(), 80);
- }
+#[test]
+fn object_creation() {
+ let screen = vt100::Screen::new(24, 80);
+ assert_eq!(screen.rows(), 24);
+ assert_eq!(screen.cols(), 80);
+}
- #[test]
- fn process_text() {
- let mut screen = vt100::Screen::new(24, 80);
- let input = b"foo\x1b[31m\x1b[32mb\x1b[3;7;42ma\x1b[23mr";
- screen.process(input);
- assert_eq!(screen.window_contents(0, 0, 0, 50), "foobar\n");
- }
+#[test]
+fn process_text() {
+ let mut screen = vt100::Screen::new(24, 80);
+ let input = b"foo\x1b[31m\x1b[32mb\x1b[3;7;42ma\x1b[23mr";
+ screen.process(input);
+ assert_eq!(screen.window_contents(0, 0, 0, 50), "foobar\n");
+}
- #[test]
- fn set_window_size() {
- let screen = vt100::Screen::new(24, 80);
- assert_eq!(screen.rows(), 24);
- assert_eq!(screen.cols(), 80);
+#[test]
+fn set_window_size() {
+ let screen = vt100::Screen::new(24, 80);
+ assert_eq!(screen.rows(), 24);
+ assert_eq!(screen.cols(), 80);
- screen.set_window_size(34, 8);
- assert_eq!(screen.rows(), 34);
- assert_eq!(screen.cols(), 8);
- }
+ screen.set_window_size(34, 8);
+ assert_eq!(screen.rows(), 34);
+ assert_eq!(screen.cols(), 8);
+}
- #[test]
- fn cell_contents() {
- let mut screen = vt100::Screen::new(24, 80);
- let input = b"foo\x1b[31m\x1b[32mb\x1b[3;7;42ma\x1b[23mr";
- screen.process(input);
- assert_eq!(screen.cell(0, 0).unwrap().contents(), "f");
- assert_eq!(screen.cell(0, 1).unwrap().contents(), "o");
- assert_eq!(screen.cell(0, 2).unwrap().contents(), "o");
- assert_eq!(screen.cell(0, 3).unwrap().contents(), "b");
- assert_eq!(screen.cell(0, 4).unwrap().contents(), "a");
- assert_eq!(screen.cell(0, 5).unwrap().contents(), "r");
- assert_eq!(screen.cell(0, 6).unwrap().contents(), "");
- }
+#[test]
+fn cell_contents() {
+ let mut screen = vt100::Screen::new(24, 80);
+ let input = b"foo\x1b[31m\x1b[32mb\x1b[3;7;42ma\x1b[23mr";
+ screen.process(input);
+ assert_eq!(screen.cell(0, 0).unwrap().contents(), "f");
+ assert_eq!(screen.cell(0, 1).unwrap().contents(), "o");
+ assert_eq!(screen.cell(0, 2).unwrap().contents(), "o");
+ assert_eq!(screen.cell(0, 3).unwrap().contents(), "b");
+ assert_eq!(screen.cell(0, 4).unwrap().contents(), "a");
+ assert_eq!(screen.cell(0, 5).unwrap().contents(), "r");
+ assert_eq!(screen.cell(0, 6).unwrap().contents(), "");
+}
- #[test]
- fn cell_colors() {
- let mut screen = vt100::Screen::new(24, 80);
- let input = b"foo\x1b[31m\x1b[32mb\x1b[3;7;42ma\x1b[23mr";
- screen.process(input);
+#[test]
+fn cell_colors() {
+ let mut screen = vt100::Screen::new(24, 80);
+ let input = b"foo\x1b[31m\x1b[32mb\x1b[3;7;42ma\x1b[23mr";
+ screen.process(input);
- assert_eq!(
- screen.cell(0, 0).unwrap().fgcolor(),
- vt100::Color::ColorDefault
- );
- assert_eq!(
- screen.cell(0, 3).unwrap().fgcolor(),
- vt100::Color::ColorIdx(2)
- );
- assert_eq!(
- screen.cell(0, 4).unwrap().fgcolor(),
- vt100::Color::ColorIdx(2)
- );
- assert_eq!(
- screen.cell(0, 4).unwrap().bgcolor(),
- vt100::Color::ColorIdx(2)
- );
- }
+ assert_eq!(
+ screen.cell(0, 0).unwrap().fgcolor(),
+ vt100::Color::ColorDefault
+ );
+ assert_eq!(
+ screen.cell(0, 3).unwrap().fgcolor(),
+ vt100::Color::ColorIdx(2)
+ );
+ assert_eq!(
+ screen.cell(0, 4).unwrap().fgcolor(),
+ vt100::Color::ColorIdx(2)
+ );
+ assert_eq!(
+ screen.cell(0, 4).unwrap().bgcolor(),
+ vt100::Color::ColorIdx(2)
+ );
+}
- #[test]
- fn cell_attrs() {
- let mut screen = vt100::Screen::new(24, 80);
- let input = b"foo\x1b[31m\x1b[32mb\x1b[3;7;42ma\x1b[23mr";
- screen.process(input);
+#[test]
+fn cell_attrs() {
+ let mut screen = vt100::Screen::new(24, 80);
+ let input = b"foo\x1b[31m\x1b[32mb\x1b[3;7;42ma\x1b[23mr";
+ screen.process(input);
- assert!(screen.cell(0, 4).unwrap().italic());
- }
+ assert!(screen.cell(0, 4).unwrap().italic());
}