Merge branch 'develop'

This commit is contained in:
2020-11-24 11:25:21 +00:00
4 changed files with 28 additions and 19 deletions

View File

@@ -17,7 +17,7 @@ pub fn main() {
.short('H') .short('H')
.long("hands") .long("hands")
.takes_value(false) .takes_value(false)
.about("TURNS 👏 YOUR 👏 TEXT 👏 INTO 👏 THIS"), .about("TURNS \u{1f44f} YOUR \u{1f44f} TEXT \u{1f44f} INTO \u{1f44f} THIS"),
) )
.get_matches(); .get_matches();

View File

@@ -1,27 +1,33 @@
#[must_use]
pub fn handify(input: &str) -> String { pub fn handify(input: &str) -> String {
let input = input.to_uppercase(); let input = input.to_uppercase();
let input = input.trim().to_owned(); let input = input.trim().to_owned();
let mut input = input.replace(" ", " 👏 "); let mut input = input.replace(" ", " \u{1f44f} ");
if !input.is_empty() { if !input.is_empty() {
input = format!("👏 {} 👏", input); input = format!("\u{1f44f} {} \u{1f44f}", input);
} }
input input
} }
#[test] #[cfg(test)]
fn handify_test_no_trailing_spaces() { mod test {
let input = "hello world"; use super::*;
assert_eq!(handify(input), "👏 HELLO 👏 WORLD 👏");
}
#[test] #[test]
fn handify_test_with_trailing_spaces() { fn handify_test_no_trailing_spaces() {
let input = " hello world "; let input = "hello world";
assert_eq!(handify(input), "👏 HELLO 👏 WORLD 👏") assert_eq!(handify(input), "\u{1f44f} HELLO \u{1f44f} WORLD \u{1f44f}");
} }
#[test] #[test]
fn handify_test_empty_string() { fn handify_test_with_trailing_spaces() {
let input = ""; let input = " hello world ";
assert_eq!(handify(input), ""); assert_eq!(handify(input), "\u{1f44f} HELLO \u{1f44f} WORLD \u{1f44f}")
}
#[test]
fn handify_test_empty_string() {
let input = "";
assert_eq!(handify(input), "");
}
} }

View File

@@ -1,3 +1,8 @@
#![warn(
clippy::all,
clippy::pedantic
)]
#[macro_use] #[macro_use]
extern crate prettytable; extern crate prettytable;
pub mod entrypoint; pub mod entrypoint;

View File

@@ -1,5 +1,3 @@
use emojifier;
fn main() { fn main() {
emojifier::entrypoint::main(); emojifier::entrypoint::main();
} }