Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #55 from dominikwilkowski/tests
Tests
- Loading branch information
Showing
5 changed files
with
53 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
extern crate cfonts; | ||
|
||
use cfonts::config::{Align, BgColors, Colors, Env, Fonts, OptionType, Options, CLIOPTIONS}; | ||
|
||
#[cfg(test)] | ||
mod tests { | ||
use super::*; | ||
|
||
#[test] | ||
fn clone_traits_work() { | ||
let _fonts = Fonts::FontConsole.clone(); | ||
let _colors = Colors::System.clone(); | ||
let _bgcolors = BgColors::Transparent.clone(); | ||
let _env = Env::Cli.clone(); | ||
let _align = Align::Top.clone(); | ||
let options = Options::default(); | ||
let options2 = options.clone(); | ||
assert!(options == options2); | ||
} | ||
|
||
#[test] | ||
fn equality_works() { | ||
assert!(OptionType::Text == OptionType::Text); | ||
assert!(CLIOPTIONS[0] == CLIOPTIONS[0]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
extern crate cfonts; | ||
|
||
#[cfg(test)] | ||
mod tests { | ||
use assert_cmd::prelude::*; | ||
use std::process::Command; | ||
|
||
#[test] | ||
fn version_works() { | ||
let output = | ||
Command::cargo_bin("cfonts").unwrap().args(vec!["-v"]).output().expect("failed to execute rust process"); | ||
|
||
assert!(String::from_utf8_lossy(&output.stdout).to_string().contains('v')); | ||
} | ||
|
||
#[test] | ||
fn help_works() { | ||
let output = | ||
Command::cargo_bin("cfonts").unwrap().args(vec!["-h"]).output().expect("failed to execute rust process"); | ||
|
||
assert!(String::from_utf8_lossy(&output.stdout).to_string().contains("Give your cli some love.")); | ||
} | ||
} |