mirror of
https://github.com/bspeice/dtparse
synced 2025-07-01 05:46:14 -04:00
Redo the tokenization
Still has issues with one test case for fuzzy
This commit is contained in:

committed by
Bradlee Speice

parent
9135962839
commit
e049618fff
17
src/tests/fuzzing.rs
Normal file
17
src/tests/fuzzing.rs
Normal file
@ -0,0 +1,17 @@
|
||||
use chrono::NaiveDate;
|
||||
use std::collections::HashMap;
|
||||
|
||||
use parse;
|
||||
use ParseError;
|
||||
use Parser;
|
||||
|
||||
#[test]
|
||||
fn test_fuzz() {
|
||||
|
||||
assert_eq!(parse("\x2D\x38\x31\x39\x34\x38\x34"), Err(ParseError::InvalidMonth));
|
||||
|
||||
let default = NaiveDate::from_ymd(2016, 6, 29).and_hms(0, 0, 0);
|
||||
let mut p = Parser::default();
|
||||
let res = p.parse("\x0D\x31", None, None, false, false, Some(&default), false, HashMap::new()).unwrap();
|
||||
assert_eq!(res.0, default);
|
||||
}
|
Reference in New Issue
Block a user