I'm writing a serde/TOML parser for config files I need for an application.
There are a number of mandatory fields. I want to test the parser thoroughly. This leads to conflicting pressures:
- I want the parser to fail to parse any config file which omits any field whose type is not
- I want to be able to write fine-grained tests about the how individual fields (or small groups of related fields) are parsed.
The failure to parse inputs with missing fields is pushing me to inject them as noise in the fine-grained test case data.
Can you suggest a way of reconciling these opposing pressures?
Is there some switch which would relax the requirement that non-
Option fields be present, without modifying the definition of the struct being parsed?