mirror of
https://github.com/tealdeer-rs/tealdeer.git
synced 2026-08-22 08:04:19 +02:00
Moved test from main.rs to types.rs
This commit is contained in:
parent
2f72a1daeb
commit
30af8ca90f
2 changed files with 13 additions and 18 deletions
18
src/main.rs
18
src/main.rs
|
|
@ -262,21 +262,3 @@ fn main() {
|
|||
process::exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use types::LineType;
|
||||
|
||||
#[test]
|
||||
fn test_linetype_from_str() {
|
||||
assert_eq!(LineType::from(""), LineType::Empty);
|
||||
assert_eq!(LineType::from(" \n \r"), LineType::Empty);
|
||||
assert_eq!(LineType::from("# Hello there"), LineType::Title("Hello there".into()));
|
||||
assert_eq!(LineType::from("> tis a description \n"), LineType::Description("tis a description".into()));
|
||||
assert_eq!(LineType::from("- some command"), LineType::ExampleText("some command".into()));
|
||||
assert_eq!(LineType::from("`$ cargo run`"), LineType::ExampleCode("$ cargo run".into()));
|
||||
assert_eq!(LineType::from("`$ cargo run"), LineType::Other("`$ cargo run".into()));
|
||||
assert_eq!(LineType::from("jkl\u{f6}"), LineType::Other("jkl\u{f6}".into()));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
13
src/types.rs
13
src/types.rs
|
|
@ -65,6 +65,7 @@ mod test {
|
|||
extern crate docopt;
|
||||
|
||||
use super::OsType::{self, Linux, OsX, SunOs, Other};
|
||||
use super::LineType;
|
||||
use rustc_serialize::json;
|
||||
|
||||
#[test]
|
||||
|
|
@ -85,4 +86,16 @@ mod test {
|
|||
fn test_os_type_decoding_unknown() {
|
||||
assert!(json::decode::<OsType>("\"lindows\"").is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_linetype_from_str() {
|
||||
assert_eq!(LineType::from(""), LineType::Empty);
|
||||
assert_eq!(LineType::from(" \n \r"), LineType::Empty);
|
||||
assert_eq!(LineType::from("# Hello there"), LineType::Title("Hello there".into()));
|
||||
assert_eq!(LineType::from("> tis a description \n"), LineType::Description("tis a description".into()));
|
||||
assert_eq!(LineType::from("- some command"), LineType::ExampleText("some command".into()));
|
||||
assert_eq!(LineType::from("`$ cargo run`"), LineType::ExampleCode("$ cargo run".into()));
|
||||
assert_eq!(LineType::from("`$ cargo run"), LineType::Other("`$ cargo run".into()));
|
||||
assert_eq!(LineType::from("jkl\u{f6}"), LineType::Other("jkl\u{f6}".into()));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue