date-check: Recognize capitalized 'Date' as well
Now, if people use 'Date' instead of 'date', it won't be ignored.
This commit is contained in:
parent
5bfa8c9a9c
commit
52a33e718d
|
|
@ -39,7 +39,7 @@ fn make_date_regex() -> Regex {
|
||||||
Regex::new(
|
Regex::new(
|
||||||
r"(?x) # insignificant whitespace mode
|
r"(?x) # insignificant whitespace mode
|
||||||
<!--\s*
|
<!--\s*
|
||||||
date:\s*
|
[dD]ate:\s*
|
||||||
(?P<y>\d{4}) # year
|
(?P<y>\d{4}) # year
|
||||||
-
|
-
|
||||||
(?P<m>\d{2}) # month
|
(?P<m>\d{2}) # month
|
||||||
|
|
@ -186,6 +186,12 @@ mod tests {
|
||||||
assert!(regex.is_match("foo <!-- date: 2021-01 --> bar"));
|
assert!(regex.is_match("foo <!-- date: 2021-01 --> bar"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_date_regex_capitalized() {
|
||||||
|
let regex = make_date_regex();
|
||||||
|
assert!(regex.is_match("foo <!-- Date: 2021-08 --> bar"));
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_collect_dates_from_file() {
|
fn test_collect_dates_from_file() {
|
||||||
let text = "Test1\n<!-- date: 2021-01 -->\nTest2\nFoo<!-- date: 2021-02 \
|
let text = "Test1\n<!-- date: 2021-01 -->\nTest2\nFoo<!-- date: 2021-02 \
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue