#![allow(rustdoc::bare_urls)]
#![cfg_attr(not(feature = "derive"), doc = " ```ignore")]
#![doc = include_str!("../examples/kickable.rs")]
pub use anyhow::Result;
pub mod args;
pub mod config;
pub mod i18n;
pub fn validate(input: &str) -> bool {
if input.trim().to_lowercase() == "it" {
return true;
}
false
}
pub fn validate_amongst(input: &str, items: Vec<String>) -> bool {
for item in items.into_iter() {
if input.trim().to_lowercase() == item.trim().to_lowercase() {
return true;
}
}
false
}
#[cfg(test)]
#[cfg(not(tarpaulin_include))]
mod tests {
use super::*;
#[test]
fn validate_should_pass_it() {
let result = validate("it");
assert_eq!(result, true);
}
#[test]
fn validate_should_pass_it_upper() {
let result = validate("IT");
assert_eq!(result, true);
}
#[test]
fn validate_should_pass_it_padded() {
let result = validate(" it ");
assert_eq!(result, true);
}
#[test]
fn validate_should_fail_empty() {
let result = validate("");
assert_eq!(result, false);
}
#[test]
fn validate_should_fail_other() {
let result = validate("other");
assert_eq!(result, false);
}
#[test]
fn validate_amongst_should_pass_it() {
let result = validate_amongst("it", vec!["other".to_string(), "it".to_string()]);
assert_eq!(result, true);
}
#[test]
fn validate_amongst_should_pass_it_upper() {
let result = validate_amongst("IT", vec!["it".to_string()]);
assert_eq!(result, true);
}
#[test]
fn validate_amongst_should_pass_it_padded() {
let result = validate_amongst(" it ", vec!["it".to_string()]);
assert_eq!(result, true);
}
#[test]
fn validate_amongst_should_fail_empty() {
let result = validate_amongst("", vec!["it".to_string()]);
assert_eq!(result, false);
}
#[test]
fn validate_amongst_should_fail_other() {
let result = validate_amongst("other", vec!["it".to_string()]);
assert_eq!(result, false);
}
}