1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#![cfg_attr(not(feature = "derive"), doc = " ```ignore")]
#![cfg_attr(feature = "derive", doc = " ```no_run")]
#![doc = include_str!("../examples/kickable.rs")]
pub use anyhow::Result;
pub mod args;
#[allow(rustdoc::bare_urls)]
#[cfg_attr(not(feature = "derive"), doc = " ```ignore")]
#[doc = include_str!("../examples/kickable.rs")]
pub fn validate(input: &str) -> bool {
if input.trim().to_lowercase() == "it" {
return true;
}
false
}
#[cfg(test)]
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);
}
}