diff options
author | Jovansonlee Cesar <ivanceras@gmail.com> | 2018-10-02 00:30:12 +0800 |
---|---|---|
committer | Jovansonlee Cesar <ivanceras@gmail.com> | 2018-10-02 00:30:12 +0800 |
commit | ac04b502509016cb6803ab1283623194c1ff94e4 (patch) | |
tree | 5363fa42efaf79103092c8546ef17483acbb1153 | |
parent | d69f6cfe00f8ea3fb13971ce04a42aded4c3d0a4 (diff) |
Remove old irrelevant test
-rw-r--r-- | svgbob/Cargo.lock | 94 | ||||
-rw-r--r-- | svgbob/Cargo.toml | 5 | ||||
-rw-r--r-- | svgbob/src/grid.rs | 248 | ||||
-rw-r--r-- | svgbob/tests/issues.rs | 16 | ||||
-rw-r--r-- | svgbob/tests/spec.rs | 14 | ||||
-rw-r--r-- | svgbob/tests/utf8.rs | 30 |
6 files changed, 0 insertions, 407 deletions
diff --git a/svgbob/Cargo.lock b/svgbob/Cargo.lock index c494259..cd391b6 100644 --- a/svgbob/Cargo.lock +++ b/svgbob/Cargo.lock @@ -1,79 +1,9 @@ [[package]] -name = "cc" -version = "1.0.23" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "cfg-if" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "difference" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "handlebars" -version = "0.21.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", - "pest 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", - "quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)", - "rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "libc" -version = "0.2.43" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "log" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "log" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "pest" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] name = "pom" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] -name = "pretty_assertions" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "difference 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "quick-error" -version = "1.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] -name = "rustc-serialize" -version = "0.3.24" -source = "registry+https://github.com/rust-lang/crates.io-index" - -[[package]] name = "svg" version = "0.5.11" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -82,41 +12,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" name = "svgbob" version = "0.3.1" dependencies = [ - "handlebars 0.21.1 (registry+https://github.com/rust-lang/crates.io-index)", "pom 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", - "pretty_assertions 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", "svg 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)", - "sys-info 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)", "unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] -name = "sys-info" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "cc 1.0.23 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] name = "unicode-width" version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" [metadata] -"checksum cc 1.0.23 (registry+https://github.com/rust-lang/crates.io-index)" = "c37f0efaa4b9b001fa6f02d4b644dee4af97d3414df07c51e3e4f015f3a3e131" -"checksum cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0c4e7bb64a8ebb0d856483e1e682ea3422f883c5f5615a90d51a2c82fe87fdd3" -"checksum difference 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b3304d19798a8e067e48d8e69b2c37f0b5e9b4e462504ad9e27e9f3fce02bba8" -"checksum handlebars 0.21.1 (registry+https://github.com/rust-lang/crates.io-index)" = "937e9d49d65ffb5f70e95710a6c8539addf40200275ad8b6cdba0f0a59d5814d" -"checksum libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)" = "76e3a3ef172f1a0b9a9ff0dd1491ae5e6c948b94479a3021819ba7d860c8645d" -"checksum log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b" -"checksum log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "d4fcce5fa49cc693c312001daf1d13411c4a5283796bac1084299ea3e567113f" -"checksum pest 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "0a6dda33d67c26f0aac90d324ab2eb7239c819fc7b2552fe9faa4fe88441edc8" "checksum pom 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "60f6ce597ecdcc9a098e7fddacb1065093a3d66446fa16c675e7e71d1b5c28e6" -"checksum pretty_assertions 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1d510007841e87c7a6d829a36f7f0acb72aef12e38cc89073fe39810c1d976ac" -"checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0" -"checksum rustc-serialize 0.3.24 (registry+https://github.com/rust-lang/crates.io-index)" = "dcf128d1287d2ea9d80910b5f1120d0b8eede3fbf1abe91c40d39ea7d51e6fda" "checksum svg 0.5.11 (registry+https://github.com/rust-lang/crates.io-index)" = "7518a18ac78da03c41ca0611128c6d8adf1efae0773c337d6c19793dce860c9b" -"checksum sys-info 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "617f594d3869801871433390254b4a79f2a18176d7f4ad5784fa990bc8c12986" "checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526" diff --git a/svgbob/Cargo.toml b/svgbob/Cargo.toml index 40fc798..7930329 100644 --- a/svgbob/Cargo.toml +++ b/svgbob/Cargo.toml @@ -14,8 +14,3 @@ unicode-width = "0.1" pom = "1.0.1" -[lib] -[dev-dependencies] -handlebars = "0.21" -pretty_assertions = "0.2" -sys-info = "0.5.1" diff --git a/svgbob/src/grid.rs b/svgbob/src/grid.rs index e37dd01..139659a 100644 --- a/svgbob/src/grid.rs +++ b/svgbob/src/grid.rs @@ -646,251 +646,3 @@ fn line_parse() -> pom::parser::Parser<'static, char, Vec<(usize, usize)>> { escape_string().repeat(0..) } -#[cfg(test)] -mod test_lib { - use super::Grid; - use super::Loc; - use super::Settings; - - #[test] - fn test_grid() { - let g = Grid::from_str("a统öo͡͡͡", &Settings::compact()); - println!("{:?}", g.index); - assert_eq!( - g.index, - vec![vec![ - "a".to_string(), - "统".to_string(), - "\u{0}".to_string(), - "ö".to_string(), - "o͡͡͡".to_string(), - ]] - ); - } - - #[test] - fn test_text_in_range() { - let txt = " -1234567890 -abcdefghij -klmnopqrst -uvwxyz1234 -567890abcd - "; - let g = Grid::from_str(txt, &Settings::compact()); - let loc = Loc::new(4, 3); // at 'o' - let (loc1, loc2) = loc.get_range(2, 1); - let text = g.get_text_in_range(&loc1, &loc2); - assert_eq!( - text, - vec![ - vec![ - Some(&"c".to_string()), - Some(&"d".to_string()), - Some(&"e".to_string()), - Some(&"f".to_string()), - Some(&"g".to_string()), - ], - vec![ - Some(&"m".to_string()), - Some(&"n".to_string()), - Some(&"o".to_string()), - Some(&"p".to_string()), - Some(&"q".to_string()), - ], - vec![ - Some(&"w".to_string()), - Some(&"x".to_string()), - Some(&"y".to_string()), - Some(&"z".to_string()), - Some(&"1".to_string()), - ], - ] - ); - } - - #[test] - fn test_to_string() { - let txt = "The quick brown fox -jumps over - the lazy dog. - ]"; - let g = Grid::from_str(txt, &Settings::compact()); - assert_eq!(txt, &*g.to_string()); - } - #[test] - fn test_to_trimmed_string() { - let txt = " - -The quick brown fox - -jumps over - - the lazy dog. - - "; - let g = Grid::from_str(txt, &Settings::compact()); - assert_eq!(txt, &*g.to_string()); - } - - #[test] - fn test_insert_text() { - let txt = "1234567890 -abcdefghij -klmnopqrst -uvwxyz1234 -567890abcd"; - let mut g = Grid::from_str(txt, &Settings::compact()); - g.put(&Loc::new(-1, -1), "-"); - let expected = "- - 1234567890 - abcdefghij - klmnopqrst - uvwxyz1234 - 567890abcd"; - assert_eq!(expected, &*g.to_string()); - } - - #[test] - fn test_insert_text_after() { - let txt = "\ -1234567890 -abcdefghij -klmnopqrst -uvwxyz1234 -567890abcd\ -"; - let mut g = Grid::from_str(txt, &Settings::compact()); - g.put(&Loc::new(11, 5), "1"); - let expected = "\ -1234567890 -abcdefghij -klmnopqrst -uvwxyz1234 -567890abcd - 1\ -"; - assert_eq!(expected, &*g.to_string()); - } - - #[test] - fn test_slash0_space() { - let txt = "件hello统"; - let g = Grid::from_str(txt, &Settings::compact()); - let s = g.to_string(); - assert_eq!(txt, s); - } - -} - -#[cfg(test)] -mod test { - use super::super::Loc; - use super::super::Settings; - use super::FocusChar; - use super::Grid; - use fragments::Direction::*; - use properties::Location; - - use fragments::Block::{O, U, Y}; - - #[test] - fn test_adjascent() { - let g = Grid::from_str("a统öo͡͡͡", &Settings::compact()); - let fc = FocusChar::new(&Loc::new(1, 0), &g); - println!("{:?}", fc); - assert!(fc.left().is('a')); - assert!(fc.right().right().is('ö')); - } - - #[test] - fn test100() { - // ._ - let g = Grid::from_str(".-", &Settings::separate_lines()); - let fc = FocusChar::new(&Loc::new(0, 0), &g); - let (frags, _consumed) = fc.get_fragments(); - println!("frags: {:?}", frags); - assert!(fc.is_intensified(&O)); - assert!(fc.can_be_strong_block(&O)); - } - - #[test] - fn test_location() { - // ._ - let g = Grid::from_str(".-", &Settings::separate_lines()); - let fc = FocusChar::new(&Loc::new(0, 0), &g); - let (_frags, _consumed) = fc.get_fragments(); - let go_right = fc.from_location(&Location::go(Right)); - let right = fc.right(); - let right2 = fc.in_right(2); - let mut right2_loop = fc.clone(); - for _ in 0..2 { - right2_loop = right2_loop.in_right(1); - } - println!("in right 2: {:?}", right2.loc); - println!("in right 2 loop: {:?}", right2_loop.loc); - assert_eq!(right2.loc, right2_loop.loc); - assert_eq!(go_right.loc, right.loc); - } - - #[test] - fn test_loc() { - let g = Grid::from_str("", &Settings::separate_lines()); - let fc = FocusChar::new(&Loc::new(0, 0), &g); - let right = fc.right(); - let in_right = fc.in_right(1); - assert_eq!(Loc::new(1, 0), right.loc); - assert_eq!(Loc::new(1, 0), in_right.loc); - } - - #[test] - fn test1() { - // ._ - let g = Grid::from_str("._", &Settings::separate_lines()); - let fc = FocusChar::new(&Loc::new(0, 0), &g); - println!("focus char: {:#?}", fc); - let (frags, _consumed) = fc.get_fragments(); - println!("frags: {:?}", frags); - assert!(!fc.is_intensified(&U)); - assert!(fc.is_intensified(&Y)); - } - #[test] - fn test2() { - // ._ - let g = Grid::from_str("._", &Settings::separate_lines()); - let fc = FocusChar::new(&Loc::new(1, 0), &g); - println!("focus char: {:#?}", fc); - let (frags, _consumed) = fc.get_fragments(); - println!("frags: {:?}", frags); - assert!(!fc.is_intensified(&Y)); - assert!(!fc.is_intensified(&U)); - assert!(fc.can_be_strong_block(&Y)); - assert!(fc.can_be_strong_block(&U)); - } - - #[test] - fn test_no_character() { - use properties::Properties; - use {FocusChar, Grid, Loc, Settings}; - - let g = Grid::from_str(".l", &Settings::separate_lines()); - let fc = FocusChar::new(&Loc::new(1, 0), &g); - println!("focus char: {:#?}", fc); - let character = fc.ch.get_characteristic(); - println!("character: {:#?}", character); - assert!(character.is_none()); - } - - #[test] - fn test_has_character() { - use properties::Properties; - use {FocusChar, Grid, Loc, Settings}; - - let g = Grid::from_str(".╦", &Settings::separate_lines()); - let fc = FocusChar::new(&Loc::new(1, 0), &g); - println!("focus char: {:#?}", fc); - let character = fc.ch.get_characteristic(); - println!("character: {:#?}", character); - assert!(character.is_some()); - } -} diff --git a/svgbob/tests/issues.rs b/svgbob/tests/issues.rs deleted file mode 100644 index 651c368..0000000 --- a/svgbob/tests/issues.rs +++ /dev/null @@ -1,16 +0,0 @@ -extern crate svgbob; - -//#[test] -fn issue15() { - use svgbob::{Grid, Settings}; - let input = "+--+\n| |\n+--+"; - let g = Grid::from_str(input, &Settings::separate_lines()); - println!("grid: {:?}", g); - let result = g.get_svg_nodes_only(); - println!("grid: {:?}", g.to_string()); - let expected = - "<line x1=\"0\" x2=\"8\" y1=\"8\" y2=\"8\"/><line x1=\"0\" x2=\"8\" y1=\"8\" y2=\"8\"/>"; - println!("expected: {}", expected); - println!("result: {}", result); - assert_eq!(result, expected); -} diff --git a/svgbob/tests/spec.rs b/svgbob/tests/spec.rs deleted file mode 100644 index f10565e..0000000 --- a/svgbob/tests/spec.rs +++ /dev/null @@ -1,14 +0,0 @@ -extern crate svgbob; - -#[test] -fn test_dash_alone() { - use svgbob::{Grid, Settings}; - - let g = Grid::from_str("-", &Settings::separate_lines()); - println!("grid: {:?}", g); - let result = g.get_svg_nodes_only(); - println!("grid: {:?}", g.to_string()); - let expected = - "<line x1=\"0\" x2=\"8\" y1=\"8\" y2=\"8\"/><line x1=\"0\" x2=\"8\" y1=\"8\" y2=\"8\"/>"; - assert_eq!(result, expected); -} diff --git a/svgbob/tests/utf8.rs b/svgbob/tests/utf8.rs deleted file mode 100644 index 0dbd13d..0000000 --- a/svgbob/tests/utf8.rs +++ /dev/null @@ -1,30 +0,0 @@ -#[test] -fn char_len() { - let s = "💖"; - let ch = '💖'; - let chin = "理"; - println!("s: {} {} {}", s, s.len(), s.chars().count()); - println!("ch: {} {}", ch, ch.len_utf8()); - println!( - "chin: {} {} {} {:?}", - chin, - chin.len(), - s.chars().count(), - chin.chars().nth(0).unwrap().len_utf8() - ); - assert_eq!(ch.len_utf8(), 4); - assert_eq!(s.len(), 4); - assert_eq!(s.chars().count(), 1); - assert_eq!(chin.len(), 3); - assert_eq!(chin.chars().count(), 1); -} - -#[test] -fn test_zero_width() { - let s = "٩(̾●̮̮̃ ̾•̃̾)۶"; - let s1 = "●̮̮̃"; - assert_eq!(s.len(), 27); - assert_eq!(s.chars().count(), 14); - assert_eq!(s1.len(), 9); - assert_eq!(s1.chars().count(), 4); -} |