Merge branch 'develop'
This commit is contained in:
@@ -17,7 +17,7 @@ pub fn main() {
|
||||
.short('H')
|
||||
.long("hands")
|
||||
.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();
|
||||
|
||||
|
||||
14
src/hands.rs
14
src/hands.rs
@@ -1,23 +1,28 @@
|
||||
#[must_use]
|
||||
pub fn handify(input: &str) -> String {
|
||||
let input = input.to_uppercase();
|
||||
let input = input.trim().to_owned();
|
||||
let mut input = input.replace(" ", " 👏 ");
|
||||
let mut input = input.replace(" ", " \u{1f44f} ");
|
||||
if !input.is_empty() {
|
||||
input = format!("👏 {} 👏", input);
|
||||
input = format!("\u{1f44f} {} \u{1f44f}", input);
|
||||
}
|
||||
input
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn handify_test_no_trailing_spaces() {
|
||||
let input = "hello world";
|
||||
assert_eq!(handify(input), "👏 HELLO 👏 WORLD 👏");
|
||||
assert_eq!(handify(input), "\u{1f44f} HELLO \u{1f44f} WORLD \u{1f44f}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn handify_test_with_trailing_spaces() {
|
||||
let input = " hello world ";
|
||||
assert_eq!(handify(input), "👏 HELLO 👏 WORLD 👏")
|
||||
assert_eq!(handify(input), "\u{1f44f} HELLO \u{1f44f} WORLD \u{1f44f}")
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -25,3 +30,4 @@ fn handify_test_empty_string() {
|
||||
let input = "";
|
||||
assert_eq!(handify(input), "");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
#![warn(
|
||||
clippy::all,
|
||||
clippy::pedantic
|
||||
)]
|
||||
|
||||
#[macro_use]
|
||||
extern crate prettytable;
|
||||
pub mod entrypoint;
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
use emojifier;
|
||||
|
||||
fn main() {
|
||||
emojifier::entrypoint::main();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user