mirror of
https://github.com/notohh/rustlings.git
synced 2024-10-30 16:59:12 -04:00
Make "I AM NOT DONE" caseless
This commit is contained in:
parent
c0c112985b
commit
bdf826a026
1 changed files with 4 additions and 12 deletions
|
@ -5,7 +5,7 @@ use std::io::{self, BufRead, BufReader};
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::process::{self, Command};
|
use std::process::{self, Command};
|
||||||
use std::{array, env, mem};
|
use std::{array, env, mem};
|
||||||
use winnow::ascii::{space0, space1};
|
use winnow::ascii::{space0, Caseless};
|
||||||
use winnow::combinator::opt;
|
use winnow::combinator::opt;
|
||||||
use winnow::Parser;
|
use winnow::Parser;
|
||||||
|
|
||||||
|
@ -21,13 +21,7 @@ fn not_done(input: &str) -> bool {
|
||||||
"//",
|
"//",
|
||||||
opt('/'),
|
opt('/'),
|
||||||
space0,
|
space0,
|
||||||
'I',
|
Caseless("I AM NOT DONE"),
|
||||||
space1,
|
|
||||||
"AM",
|
|
||||||
space1,
|
|
||||||
"NOT",
|
|
||||||
space1,
|
|
||||||
"DONE",
|
|
||||||
)
|
)
|
||||||
.parse_next(&mut &*input)
|
.parse_next(&mut &*input)
|
||||||
.is_ok()
|
.is_ok()
|
||||||
|
@ -438,15 +432,13 @@ mod test {
|
||||||
assert!(not_done("/// I AM NOT DONE"));
|
assert!(not_done("/// I AM NOT DONE"));
|
||||||
assert!(not_done("// I AM NOT DONE"));
|
assert!(not_done("// I AM NOT DONE"));
|
||||||
assert!(not_done("/// I AM NOT DONE"));
|
assert!(not_done("/// I AM NOT DONE"));
|
||||||
assert!(not_done("// I AM NOT DONE"));
|
|
||||||
assert!(not_done("// I AM NOT DONE"));
|
|
||||||
assert!(not_done("// I AM NOT DONE"));
|
|
||||||
assert!(not_done("// I AM NOT DONE "));
|
assert!(not_done("// I AM NOT DONE "));
|
||||||
assert!(not_done("// I AM NOT DONE!"));
|
assert!(not_done("// I AM NOT DONE!"));
|
||||||
|
assert!(not_done("// I am not done"));
|
||||||
|
assert!(not_done("// i am NOT done"));
|
||||||
|
|
||||||
assert!(!not_done("I AM NOT DONE"));
|
assert!(!not_done("I AM NOT DONE"));
|
||||||
assert!(!not_done("// NOT DONE"));
|
assert!(!not_done("// NOT DONE"));
|
||||||
assert!(!not_done("DONE"));
|
assert!(!not_done("DONE"));
|
||||||
assert!(!not_done("// i am not done"));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue