Skip to content

Commit bdf826a

Browse files
committed
Make "I AM NOT DONE" caseless
1 parent c0c1129 commit bdf826a

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

src/exercise.rs

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use std::io::{self, BufRead, BufReader};
55
use std::path::PathBuf;
66
use std::process::{self, Command};
77
use std::{array, env, mem};
8-
use winnow::ascii::{space0, space1};
8+
use winnow::ascii::{space0, Caseless};
99
use winnow::combinator::opt;
1010
use winnow::Parser;
1111

@@ -21,13 +21,7 @@ fn not_done(input: &str) -> bool {
2121
"//",
2222
opt('/'),
2323
space0,
24-
'I',
25-
space1,
26-
"AM",
27-
space1,
28-
"NOT",
29-
space1,
30-
"DONE",
24+
Caseless("I AM NOT DONE"),
3125
)
3226
.parse_next(&mut &*input)
3327
.is_ok()
@@ -438,15 +432,13 @@ mod test {
438432
assert!(not_done("/// I AM NOT DONE"));
439433
assert!(not_done("// I AM NOT DONE"));
440434
assert!(not_done("/// I AM NOT DONE"));
441-
assert!(not_done("// I AM NOT DONE"));
442-
assert!(not_done("// I AM NOT DONE"));
443-
assert!(not_done("// I AM NOT DONE"));
444435
assert!(not_done("// I AM NOT DONE "));
445436
assert!(not_done("// I AM NOT DONE!"));
437+
assert!(not_done("// I am not done"));
438+
assert!(not_done("// i am NOT done"));
446439

447440
assert!(!not_done("I AM NOT DONE"));
448441
assert!(!not_done("// NOT DONE"));
449442
assert!(!not_done("DONE"));
450-
assert!(!not_done("// i am not done"));
451443
}
452444
}

0 commit comments

Comments
 (0)