summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormo8it <mo8it@proton.me>2024-03-24 22:22:55 +0100
committermo8it <mo8it@proton.me>2024-03-24 22:22:55 +0100
commitbdf826a026cfe7f89c31433cfd2b9a32cbe66d2c (patch)
tree26fbf495a418ef407676e33eb1d18ab98d7cc322
parentc0c112985b531bbcf503a2b1a8c2764030a16c99 (diff)
Make "I AM NOT DONE" caseless
-rw-r--r--src/exercise.rs16
1 files changed, 4 insertions, 12 deletions
diff --git a/src/exercise.rs b/src/exercise.rs
index 8f580d3..136e943 100644
--- a/src/exercise.rs
+++ b/src/exercise.rs
@@ -5,7 +5,7 @@ use std::io::{self, BufRead, BufReader};
use std::path::PathBuf;
use std::process::{self, Command};
use std::{array, env, mem};
-use winnow::ascii::{space0, space1};
+use winnow::ascii::{space0, Caseless};
use winnow::combinator::opt;
use winnow::Parser;
@@ -21,13 +21,7 @@ fn not_done(input: &str) -> bool {
"//",
opt('/'),
space0,
- 'I',
- space1,
- "AM",
- space1,
- "NOT",
- space1,
- "DONE",
+ Caseless("I AM NOT DONE"),
)
.parse_next(&mut &*input)
.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("// NOT DONE"));
assert!(!not_done("DONE"));
- assert!(!not_done("// i am not done"));
}
}