From e1b809a33883de11b8201eb46689794539028655 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Thu, 28 Apr 2016 00:36:17 -0400 Subject: the tests module is unnecessary here --- tests/basic.rs | 131 +++++++++++++++++++++++++++------------------------------ 1 file 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()); } -- cgit v1.2.3-54-g00ecf